Android Question [SOLVED] StdActionBar Color

eurojam

Well-Known Member
Licensed User
Hi all,
may be I don't see the wood for the trees: is it possible to change the color of the stdActionBar for different activities - I know how to change the color theme in general - but activity main should have a blue and activity two should have a red actionbar...?

Thanks in advance
stefan
 

Erel

Administrator
Staff member
Licensed User
You can use this sub:
B4X:
Sub SetActionBarColor(Color As Int)
   Dim jo As JavaObject
   jo.InitializeContext
   Dim cd As ColorDrawable
   cd.Initialize(Color, 0)
   jo.RunMethodJO("getActionBar", Null).RunMethod("setBackgroundDrawable", Array(cd))
End Sub
If you are targeting Android 2.x devices then you should first check the SDK version with the phone library.


You can also use other types of drawables:

upload_2016-2-29_11-1-49.png
 

eelias

Active Member
Licensed User
I am still using B4A 3.82, is it possible to have this same solution for it?
 

ZenWhisk

Member
Licensed User
This function works fine, but in Material Design, I lose the 'elevation' shadow, is there any way to avoid that?
 
Top