material-components

Can't set background color of button using Material Components library

折月煮酒 提交于 2020-05-15 08:03:07
问题 My code: <Button android:id="@+id/button_one" style="@style/ButtonStyle" android:text="@string/button_one" /> <style name="ButtonStyle"> <item name="android:textSize">32sp</item> <item name="android:textColor">@drawable/background_button_text_color</item> <item name="android:background">@drawable/background_button</item </style> background_button.xml: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@android:color/white" android:state_pressed="true

MDCTextField rightView property broken on iOS 13

岁酱吖の 提交于 2020-05-12 12:42:57
问题 I can't use the rightView property with MDCTextField anymore on iOS 13. Am I the only one having an issue with this? The right view width cover the whole text field: preventing the user interaction and hiding the textView content. No problem when I switch from MDCTextField to UITextField . 回答1: Add width constraint to the rightView / leftView . Don't forget to set translatesAutoresizingMaskIntoConstraints = false rightView.translatesAutoresizingMaskIntoConstraints = false rightView

MDCTextField rightView property broken on iOS 13

我与影子孤独终老i 提交于 2020-05-12 12:42:13
问题 I can't use the rightView property with MDCTextField anymore on iOS 13. Am I the only one having an issue with this? The right view width cover the whole text field: preventing the user interaction and hiding the textView content. No problem when I switch from MDCTextField to UITextField . 回答1: Add width constraint to the rightView / leftView . Don't forget to set translatesAutoresizingMaskIntoConstraints = false rightView.translatesAutoresizingMaskIntoConstraints = false rightView

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 remove those dark circular background from floating action button?

[亡魂溺海] 提交于 2020-02-25 04:15:08
问题 I am not able to remove those dark circle background from floating action button. By default it has a circle button with above circular shade. but some how couldnt find a way to remove that shade. xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android

How to change toolbar text color from MaterialComponents.DayNight theme?

橙三吉。 提交于 2020-02-22 04:14:06
问题 I am using MaterialComponents.DayNight theme in my app. In the day mode, toolbar text color is black. But when I switch to night mode toolbar text color is remain black, so it's not visible anymore. <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> I want to change the toolbar text color into white in night mode. How can I do that? 回答1: Add this entry to your theme: <item name="android:itemTextAppearance">@style/PopupMenuTextAppearance</item> After that, add the

How to change toolbar text color from MaterialComponents.DayNight theme?

試著忘記壹切 提交于 2020-02-22 04:13:59
问题 I am using MaterialComponents.DayNight theme in my app. In the day mode, toolbar text color is black. But when I switch to night mode toolbar text color is remain black, so it's not visible anymore. <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> I want to change the toolbar text color into white in night mode. How can I do that? 回答1: Add this entry to your theme: <item name="android:itemTextAppearance">@style/PopupMenuTextAppearance</item> After that, add the

How to change toolbar text color from MaterialComponents.DayNight theme?

天涯浪子 提交于 2020-02-22 04:13:25
问题 I am using MaterialComponents.DayNight theme in my app. In the day mode, toolbar text color is black. But when I switch to night mode toolbar text color is remain black, so it's not visible anymore. <style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> I want to change the toolbar text color into white in night mode. How can I do that? 回答1: Add this entry to your theme: <item name="android:itemTextAppearance">@style/PopupMenuTextAppearance</item> After that, add the

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"