Android Question AppCompat Actionbar Color

nobbi59

Active Member
Licensed User
Longtime User
I am using the AppCompat Toolbar as an Actionbar.

Everything seems to work fine but i want to set its color at runtime. I am trying this by using the following code:

Code: Copy
Dim cd As ColorDrawable
cd.Initialize(Colors.Blue,0)
ActionBar.Background = cd

This changes the color but the Elevation is lost. And I cannot get it back by calling one of those methods:

Code: Copy
ActionBar.Elevation = 4dip
Dim ab as ACActionBar
ab.Elevation = 4

The ActionBar is added with the designer and is a ACToolBarLight.

I think the problem is that Im changing the color of the Base Panel, but idk what color i should change except that.
 
Have you looked at setting up the colors in the theme.xml file or even easier the manifest editor instead of using ColorDrawable?
 
Upvote 0
Yes I did, but i want the user to be able to select the Color of the Actionbar and not give only 5 to 10 possibilities like I can do with a theme.
 
Upvote 0
Back
Top