eurojam Well-Known Member Licensed User Longtime User Feb 29, 2016 #1 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
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 B4X founder Staff member Licensed User Longtime User Feb 29, 2016 #2 You can use this sub: Code: 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: Upvote 0
You can use this sub: Code: 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:
EduardoElias Well-Known Member Licensed User Longtime User Apr 13, 2016 #3 I am still using B4A 3.82, is it possible to have this same solution for it? Upvote 0
ZenWhisk Member Licensed User Longtime User Jan 20, 2017 #5 This function works fine, but in Material Design, I lose the 'elevation' shadow, is there any way to avoid that? Upvote 0
This function works fine, but in Material Design, I lose the 'elevation' shadow, is there any way to avoid that?
Erel B4X founder Staff member Licensed User Longtime User Jan 22, 2017 #6 Try to set the elevation with this code (change the elevation to 5dip): https://www.b4x.com/android/forum/threads/remove-material-action-bar-shadow.67640/#content Upvote 0
Try to set the elevation with this code (change the elevation to 5dip): https://www.b4x.com/android/forum/threads/remove-material-action-bar-shadow.67640/#content