android - styling submenu triangle icon - android

I can't seem to find the correct area to style the little triangle icon on my submenu. I want it to be white in color but everything I try seems to make it colored black.

it looks like this style node of the main theme affects the color of the submenu arrow/triangle:
<item name="android:textColorPrimary">#android:color/black</item>
so changing this to color/white has changed the arrow to white - but any other default text must be manually set to black now.
EDIT: I solved this a better way that doesn't effect the rest of the text color in the activity styled.
in my main theme, i defined actionBarStyle:
<item name="actionBarStyle">#style/MainActActionBar</item>
then I define:
<style name="MainActActionBar" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse" >
<item name="popupTheme">#style/MainActionBarMenu</item>
</style>
and lastly:
<style name="MainActionBarMenu" parent="Widget.AppCompat.Light.PopupMenu.Overflow" >
<item name="android:textColorPrimary">#android:color/white</item>
</style>
this gives me the white arrow i was looking for and doesn't change anything else.

copy this line in your style that you have choosen.
<item name="subMenuArrow">#style/MyStyle</item>
and define Mystyle like this in your style.xml file
<style name="MyStyle" parent="Widget.AppCompat.ListMenuView">
<item name="color">#android:color/white</item>
<item name="android:textColorSecondary">#android:color/white</item>
</style>

Related

How to change the header text color of my settings?

wallpicker app
I was actually trying to make an overlay theme that override my settings and other apps, I've somehow successfully make it transparent and change the font color but one thing i couldn't change is the header of it, in the image you'll see a "Settings" which isn't white color, that's my current problem, it also happened on other header apps just like "wallpaper picker app" and more apps
Already tried:
<item name="android:colorBackground">#android:color/primary_dark_device_default_settings</item>
<item name="android:windowBackground">#40000000</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:textColor">#ffffff</item>
adding a textColor but it didn't change the header text color or was it called an action bar?
also textColorPrimary doesn't do anything at all? and im on api 33
https://i.stack.imgur.com/3jsNN.jpg
https://i.stack.imgur.com/0Jsly.png
Try this.. In your original theme
<style name="Theme.MyApplication" parent="Theme.MaterialComponent.DayNight.NoActionBar">
<item name="toolbarStyle">#style/CustomToolbar</item>
</style>
your theme settings as follow:
<style name="CustomToolbar" parent="#style/Widget.MaterialComponents.Toolbar">
<item name="android:textColorPrimary">#android:color/white</item>
<item name="android:textColorSecondary">#android:color/white</item>
</style>

Change EditText long click menu text color

For some reason the menu that comes up on long click (for copy/paste/cut/etc...) in my EditText have white text color on a white background so it's unreadable.
I searched quite a lot on this forum but haven't found answer that would have worked so far, I have also tried adding a custom popup style for the base theme as well as for the EditText style with colorAccent, color and textColor changed, like this:
<style name="Base.AppTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Tried all 3 separately -->
<item name="android:popupMenuStyle">#style/CustomPopup</item>
<item name="popupMenuStyle">#style/CustomPopup</item>
<item name="popupTheme">#style/CustomPopup</item>
</style>
<style name="Style.Input.EditText" parent="Widget.AppCompat.EditText">
<!-- Tried all 3 separately -->
<item name="android:popupMenuStyle">#style/CustomPopup</item>
<item name="popupMenuStyle">#style/CustomPopup</item>
<item name="popupTheme">#style/CustomPopup</item>
</style>
<style name="CustomPopup" parent="Widget.AppCompat.Light.PopupMenu">
<item name="android:colorAccent">#000000</item>
<item name="android:color">#000000</item>
<item name="android:textColor">#000000</item>
</style>
Unfortunately it did not work.
Does anyone know of a way to customise this menu, the text color in particular?
Check the theme style
<item name="android:background">#FFFFFF</item>
It's highly likely that you have it set to WHITE and the text is already being set to WHITE. I would comment out this line where you're setting the background color and see if you can't figure it out from there. This was my issue.

Android - Change text colour of the bottom button bar

I'm modifying downloads (for 4.3 Jellybean) and I can't change the colour of the text on the bottom button from black to white. Is it possible to change the text colour without giving the button its own style by adding an item in the app theme? Here is my Styles.xml:
<style name="DownloadListTheme" parent="#android:style/Theme.DeviceDefault.Light.DialogWhenLarge">
<item name="android:textAlignment">viewStart</item>
<item name="android:layoutDirection">locale</item>
<item name="android:actionBarStyle">#android:style/Widget.DeviceDefault.Light.ActionBar.Solid.Inverse</item>
<item name="com.sonyericsson.uxp:extendedLookAndFeel">true</item>
<item name="android:textColor">#android:color/white</item>
</style>
Yes, you can accomplish this pretty easily, just override your theme in styles.xml like this:
<style name="MyButtonStyle"
parent="#android:style/Theme.DeviceDefault.Light.DialogWhenLarge">
<item name="android:textColor">#android:color/white</item>
</style>
For more information, see the documentation.

Customize touch feedback in Android ActionBar

I have my style defined as follows:
<style name="actionBarTheme" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/button_style</item>
<item name="android:titleTextStyle">#style/actionBarTitleText</item>
</style>
And the actionBar is actually of the color defined in button_style (correctly working in other parts of the code). The problem is that the items are not working correctly (the background color is too light).
Any idea on how to solve this? Thanks
EDIT:
In the picture there is the touch-feedback that I have now. The button_style has another touch effect (a darker one) since this is almost invisible.
You can have this affect with actionButtonStyle
<style name="appTheme">
<item name="android:actionBarStyle">#style/actionBarTheme</item>
<item name="android:actionButtonStyle">#style/actionButtonTheme</item>
</style>
and then place your button style as the background of that.
<style name="actionButtonTheme">
<item name="android:background">#drawable/button_style</item>
</style>
You will still need to set the background of your action bar but this only needs to be a colour or drawable image as that is all that will actually be used.

Styling ActionBar dropdown menu

I'm using a custom theme that inherits from DarkActionBar and I want to customize dropdown menu to be white like when using Light Holo theme.
I've been able to change the background to white using:
<style name="MyTheme" parent="#style/Theme.Light.DarkActionBar">
<item name="android:actionDropDownStyle">#style/MyDropDownNav</item>
</style>
<style name="MyDropDownNav">
<item name="android:background">#drawable/spinner_background_white</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_whyite</item>
<item name="android:dropDownSelector">#drawable/selectable_background_white</item>
</style>
But I haven't any clue of how to change the text color to black. Because after setting white drawable the problem is that text isn't visible because is white on white background.
I answer myself after some investigation.
In addition to question's styling you need to:
Customize android:spinnerDropDownItemStyle for actionBarWidgetTheme changing it's text appearance.
Also don't forget that dropdown list is managed by the adapter you use. Then if you used the standard one (simple_dropdown_item_1line) there's no problem. But if you used a custom one like me (to be able to add an icon) don't forget to apply style="?attr/spinnerDropDownItemStyle" in your layout TextView.
Then final custom style is:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.myapp" parent="#style/Theme.Light.DarkActionBar">
<item name="android:actionDropDownStyle">#style/myapp_DropDownNav</item>
<item name="android:actionBarWidgetTheme">#style/myapp.actionBarWidgetTheme</item>
</style>
<style name="myapp.actionBarWidgetTheme" parent="#style/Theme.">
<item name="android:spinnerDropDownItemStyle">#style/myapp.Widget.DropDownItem.Spinner</item>
</style>
<style name="myapp_DropDownNav" parent="#style/Widget.Spinner.DropDown.ActionBar">
<item name="background">#drawable/spinner_background_ab_myapp</item>
<item name="android:background">#drawable/spinner_background_ab_myapp</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_myapp</item>
<item name="android:dropDownSelector">#drawable/selectable_background_myapp</item>
</style>
<style name="myapp.Widget.DropDownItem.Spinner" parent="Widget.DropDownItem.Spinner">
<item name="android:textAppearance">#style/myapp.TextAppearance.Widget.DropDownItem</item>
</style>
<style name="myapp.TextAppearance.Widget.DropDownItem" parent="TextAppearance.Widget.DropDownItem">
<item name="android:textColor">#color/black</item>
</style>
Where drawables in myapp_DropDownNav are white background ones that you can generate with ActionBar Style generator in Android Asset Studio
Try setting itemTextAppearance. That should achieve what you want.
I have stumbled on what may be the simplest way to do this. I was working with the AppCompat library.
<style name="ApplicationTheme" parent="#style/Theme.AppCompat">
<item name="android:actionBarWidgetTheme">#style/Theme.AppCompat.Light</item>
<item name="actionBarWidgetTheme">#style/Theme.AppCompat.Light</item>
</style>
My advice is to simply inherit from the Sherlock.Light theme and change the applicable fields to the Dark values. For my app, we wanted a white "up" icon, and white text for the action labels. I don't provide dark versions of my actionbar icons, so they are all white anyway. So after several hours messing around with it and following different people's suggestions, I finally found what I was looking for in the ABS themes file.
I inherit from Sherlock.Light (well, technically HoloEverywhereLight.Sherlock but...) and change:
<item name="android:actionMenuTextColor">#color/White</item>
<item name="actionMenuTextColor">#color/White</item>
<item name="android:homeAsUpIndicator">#drawable/abs__ic_ab_back_holo_dark</item>
<item name="homeAsUpIndicator">#drawable/abs__ic_ab_back_holo_dark</item>
<item name="android:dividerVertical">#drawable/abs__list_divider_holo_dark</item>
<item name="dividerVertical">#drawable/abs__list_divider_holo_dark</item>
That's it. It's way simpler and easier than trying to extend classes, restyle things in code, etc.

Categories

Resources