android-button

Material Components Default to colorAccent instead of colorPrimary

泪湿孤枕 提交于 2020-05-24 03:56:21
问题 My AppTheme in styles.xml looks like this: <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:textColorPrimary">@color/textColorPrimary</item> <item name="android:windowTranslucentStatus">true</item> <item name="android:windowTranslucentNavigation"

Material design components button global theme overriding broken

廉价感情. 提交于 2020-05-15 08:06:08
问题 I want to simply apply styling to all buttons on a theme level like this <style name="BaseTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> ... <item name="buttonStyle">@style/DefaultButton</item> </style> <style name="DefaultButton" parent="Widget.MaterialComponents.Button"> <item name="android:textColor">@color/whatever</item> </style> <Button android:id="@+id/addChannelButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom

Remove space between bounds and button border

南笙酒味 提交于 2020-03-16 06:42:28
问题 How do I remove those space between Button border and view bounds tried setting padding to 0dp but with no results. These is material button with default style. 回答1: The MaterialButton has a default style with these insets: <style name="Widget.MaterialComponents.Button"..> <item name="android:insetLeft">0dp</item> <item name="android:insetRight">0dp</item> <item name="android:insetTop">@dimen/mtrl_btn_inset</item> <item name="android:insetBottom">@dimen/mtrl_btn_inset</item> ... </style> The

Remove space between bounds and button border

别等时光非礼了梦想. 提交于 2020-03-16 06:42:22
问题 How do I remove those space between Button border and view bounds tried setting padding to 0dp but with no results. These is material button with default style. 回答1: The MaterialButton has a default style with these insets: <style name="Widget.MaterialComponents.Button"..> <item name="android:insetLeft">0dp</item> <item name="android:insetRight">0dp</item> <item name="android:insetTop">@dimen/mtrl_btn_inset</item> <item name="android:insetBottom">@dimen/mtrl_btn_inset</item> ... </style> The

How to change color in Material Components PROGRAMMATICALLY on Android?

浪尽此生 提交于 2020-03-03 09:08:10
问题 I'm looking for a solution to change the color of some Android Material Components layout objects. How can I change the color of text or borders in a Material Button programmatically? All functions like MaterialButton.setTexColor() do not work. Same thing for the StrokeColor. The change must be made logically, directly from code. No XML styles, colors must be able to change in live, based on values read from a database. Things like these don't work : //renewSetDate is a Material Button Object

How to change color in Material Components PROGRAMMATICALLY on Android?

て烟熏妆下的殇ゞ 提交于 2020-03-03 09:06:26
问题 I'm looking for a solution to change the color of some Android Material Components layout objects. How can I change the color of text or borders in a Material Button programmatically? All functions like MaterialButton.setTexColor() do not work. Same thing for the StrokeColor. The change must be made logically, directly from code. No XML styles, colors must be able to change in live, based on values read from a database. Things like these don't work : //renewSetDate is a Material Button Object

How to change color in Material Components PROGRAMMATICALLY on Android?

偶尔善良 提交于 2020-03-03 09:06:14
问题 I'm looking for a solution to change the color of some Android Material Components layout objects. How can I change the color of text or borders in a Material Button programmatically? All functions like MaterialButton.setTexColor() do not work. Same thing for the StrokeColor. The change must be made logically, directly from code. No XML styles, colors must be able to change in live, based on values read from a database. Things like these don't work : //renewSetDate is a Material Button Object

Recyclerview item onClick to open a fragment from Main Activity Fragment

[亡魂溺海] 提交于 2020-02-07 05:24:25
问题 i have 4-5 fragments on MainActivity and on host fragment i have a recyclerview. on each item of recycler i have to open a fragment out of 4 more and kill the current fragment on which recycler is placed. i couldnt achieve this. here is my MainActivity where all fragments are placed and host fragment is homefragment where recycler is placed and i want to move from homefragment to another fragment when 0th item clicked public class MainActivity extends AppCompatActivity { private

Material Button Toggle Group single selection

孤者浪人 提交于 2020-02-03 04:07:26
问题 How can I force a MaterialButtonToggleGroup to act like a RadioGroup as in having at least one selected item always? Setting setSingleSelection(true) also adds the possibility to have nothing selected if you click twice on a Button in the group. Here is my code: <com.google.android.material.button.MaterialButtonToggleGroup android:id="@id/BottomSheetDialog_fromFragmentBottomSheetSort_Sort_ToggleButtonGroup" android:layout_width="wrap_content" android:layout_height="wrap_content" app

What is alternative of android:background in MaterialComponents?

你说的曾经没有我的故事 提交于 2020-01-24 20:41:06
问题 Question: android:background is not giving effect in MaterialComponents. In my project, I was using AppCompat ( <style name="DayTheme" parent="Theme.AppCompat.Light.NoActionBar"> ) and everything was working fine. but, because of some requirement in my project, now, I've to use MaterialComponents ( <style name="DayTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> ) And because of that some UI looks bad. Problem: In AppComapt, I was using android:background="@drawable/bg_circle_btn"