Android Question ClsActionBar - ChangeButton Pressed Color

WDK

Member
Licensed User
I am using the clsactionbar to create some buttons on the title bar. How can I change the color of the buttons below when they are clicked?

B4X:
Dim gd2 As GradientDrawable, col2(2) As Int
col2(0) = Colors.RGB(255, 30, 30)
col2(1) = Colors.RGB(255, 30, 30)
gd2.Initialize("TOP_BOTTOM", col2)
'AB2.ReplacePressedDrawable(gd2)
AB2.AddButton(LoadBitmap(File.DirAssets, "back.png"), "", 5, 0, "Home_Click", "Home_Click")
AB2.AddButton(LoadBitmap(File.DirAssets, "share.png"), "", 5, -1, Share_Click"", "Share_Click")
AB2.AddButton(LoadBitmap(File.DirAssets, "refresh.png"), "", 5, -1, Refresh_Click"", "Refresh_Click")
[LEFT][FONT=verdana][COLOR=rgb(20, 20, 20)]AB2.Title.Left = AB2.AsPanel.Height + 10dip
AB2.Title.Text = Main.MainCategory
AB2.Title.TextSize = 20
AB2.SetBackground(gd2)
[/COLOR][/FONT][/LEFT]

Thanks!
WDK
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I'm not familiar with ClsActionBar, however you can use AppCompat and add views directly to the action bar:

SS-2017-11-26_08.43.19.png


Start with this example: https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/
 
Upvote 0
Top