I'm having trouble making ActionBarToggleButton having custom selector.
I got app that works for mobile and tablet devices, and now I have to make it usable for TV devices.
To do that I have to add some custom focus selector, that is more visible then default one.
App uses NavigationView for drawer and has toggle button in action bar that opens it. Also there are other items in action bar.
I have managed to change selectors for all action bar items except toggle button via:
<item name="android:actionBarItemBackground">@drawable/selectable_selector</item>
Is there a way to customize ActionToggleButton
.
I dont need to change arrow drawable, but only color of the default selector.
Thanks
In API 21 and more you only need to write this item in style.xml
, in your Toolbar theme:
<item name="colorControlHighlight">@color/xxx</item>
But in lower APIs, First you should write this style in your styles.xml
:
<style name="MyToolbarTheme.Navigation" parent="@android:style/Widget">
<item name="android:background">@drawable/selector_items</item>
<item name="android:scaleType">center</item>
<item name="android:minWidth">56.0dip</item>
</style>
then add this items to your toolbar theme:
<item name="actionBarItemBackground">@drawable/selector_appbar</item>
<item name="toolbarNavigationButtonStyle">@style/MyToolbarTheme.Navigation</item>
Example:
<style name="MyToolbarTheme" parent="ThemeOverlay.AppCompat.Dark">
<item name="android:textColorPrimary">#ffffff</item>
<item name="android:textColorSecondary">#ffffff</item>
<item name="actionBarItemBackground">@drawable/selector_appbar</item>
<item name="toolbarNavigationButtonStyle">@style/MyToolbarTheme.Navigation</item>
</style>
(Sorry for my weak English)