I am using Theme.AppCompat.Light theme and using SearchView which by default shows dark texts and icons..
How can I use SearchView defined in Theme.AppCompat in this light theme?
Already tried below but not working?
<style name="Theme.App.Light" parent="Theme.AppCompat.Light">
<item name="searchViewStyle">@style/Widget.AppCompat.SearchView</item>
</style>
Even using Theme.AppCompat.Light.DarkActionBar as base theme does not show the white texts and icons..
It can be done by overriding all values,but I just need to use defaults provided in Dark theme..
The AppCompat support library provides themes to build apps with the Material Design specification. A theme with a parent of Theme. AppCompat is also required for an Activity to extend AppCompatActivity . The first step is to customize your theme's color palette to automatically colorize your app.
Per this pro-tip, Theme.AppCompat.Light.DarkActionBar
only applies if you are using the AppCompat provided Action Bar. If you are using a Toolbar
, then you should be using a Theme.AppCompat.Light.NoActionBar
theme. To theme your Toolbar appropriate for a dark background, you need to add android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
:
<android.support.v7.widget.Toolbar
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
SearchView
will then pull the correct resources needed to work on a dark background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With