Android: How to set selectors for elements in ActionBar?

I would like to programmatically set the background of the ActionBar to draw as a specific color.

For the view, I would do this by setting the view background to a custom selector that uses my specific color for the β€œselected” state; then I would call View.setSelected (boolean) to enable or disable a specific color.

Is there a way to implement the same effect for elements in an ActionBar?

+4
source share
1 answer

Many styles of the action bar are done using images, so I think the only way to do this is to create your own style or theme. See here http://android-developers.blogspot.com/2011/04/customizing-action-bar.html for more details, and also check the code here http://code.google.com/p/styled-action-bar / .

+3
source

Source: https://habr.com/ru/post/1394098/


All Articles