Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing android search dialog text color

I styled my App using a theme as described here.

<style name="MyThemeNameHere" parent="@android:style/Theme.NoTitleBar">
    <item name="android:windowBackground">@drawable/background</item>
    <item name="android:textColor">#eee</item>
<style>

It works like a charm in most of the App. The background is pretty dark while the text color is bright and text looks good and is easy to read.

Now in the search dialog that android creates for me the background is white, but the text color picks up my style and gets very bright and thus extremely hard to read. I tried also setting android:background to a dark color - This fixed the problem in the search dialog, but caused all textview, etc to get a dark background rather than transparent.

I want to either set the the color or the background only on the search dialog. How do I do this?

like image 644
vidstige Avatar asked Dec 03 '25 06:12

vidstige


1 Answers

As pointed out by Mark Philip the solution can be found in this question: Android Styling/Theming of just Search Dialog

Basically it should be styled like so

<style name="master" paret="@android:style/Theme.NoTitleBar">
    <item name="android:textColorPrimary">#EEEEEE</item>
    <item name="android:textColorSecondary">#EEEEEE</item>
    <item name="android:textColorTertiary">#EEEEEE</item>
</style>

The root cause was that I styled the android:textColor which should never be styled.

like image 92
vidstige Avatar answered Dec 04 '25 22:12

vidstige



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!