android-styles

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

How to hide status bar in android in just one activity

点点圈 提交于 2020-05-10 07:28:07
问题 I want to hide status bar / notification bar in splash screen I am using style: <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> this dose not hide the status bar, how should i do this? 回答1: If you want to remove status bar then use this before setContentView(layout) in onCreateView method getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); credits 回答2: You can do something like below for appropriately setting theme

Change status bar text color when primaryDark is white

余生颓废 提交于 2020-05-09 18:16:10
问题 I am trying to reproduce the behaviour of Google Calendar application: but I have not found a way to change the status text color. If i set the colorPrimaryDark as white I cannot see the icons neither text of status bar due their color is white as well. Is there any way to change the status bar text color? Thanks in advance 回答1: I'm not sure what API level your trying to target, but if you can use API 23 specific stuff, you can add the following to your AppTheme styles.xml: <item name=

Compiler error when applying theme with databinding

为君一笑 提交于 2020-04-18 05:42:14
问题 My code shuffles colors and indexes for a list of ColorBox objects indefinitely. This is my view: <TextView style="@style/App.WidgetStyle.ColorBox" android:text="@{item.id}" android:theme="@{item.theme}" tools:text="A" tools:theme="@style/App.ColorBox" /> My styles: <style name="App.WidgetStyle.ColorBox" parent="App"> <item name="android:layout_width">@dimen/square_size</item> <item name="android:layout_height">@dimen/square_size</item> <item name="android:background">@drawable/shape_for

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

How to set style to a progressBar programmatically on Android

假如想象 提交于 2020-02-19 09:51:09
问题 I have ProgressBar style in style.xml. When I create layout, put there ProgressBar and set style like: style="@style/ProgressBarStyle" set layout to dialog and all is fine. Other way create view for dialog programmatically. So for ProgressBar I have next code: new ProgressBar(context, null, R.style.ProgressBarStyle); But in this way there is nothing instead ProgressBar. P.S. I don't forget add ProgressBar to view which I set as dialog view. 回答1: You can set your style from the constructor,

Missing TextAppearances.Micro style

时光毁灭记忆、已成空白 提交于 2020-02-04 20:44:24
问题 According to Android Developer Design Style for Typography, there are 4 TextAppearance s (Micro, Small, Medium, Large). But there is no predefined style for Micro: ?android:attr/textAppearanceMicro android:style/TextAppearance.Micro None of them can be found in sources of Android. What am I missing? 回答1: Good question! After researching a little bit, I didn't find any results for "TextAppearance.Micro". On the other hand, I found the official Android source for style resource related to

Missing TextAppearances.Micro style

邮差的信 提交于 2020-02-04 20:43:09
问题 According to Android Developer Design Style for Typography, there are 4 TextAppearance s (Micro, Small, Medium, Large). But there is no predefined style for Micro: ?android:attr/textAppearanceMicro android:style/TextAppearance.Micro None of them can be found in sources of Android. What am I missing? 回答1: Good question! After researching a little bit, I didn't find any results for "TextAppearance.Micro". On the other hand, I found the official Android source for style resource related to