Android Question Placing panel to far left on ACToolbar

RB Smissaert

Well-Known Member
Licensed User
Longtime User
I have an ACToolbar (ACToolBarLight) with a panel added with 2 buttons added to this panel. The buttons are for changing menu groups.
I want the panel flush left on the ACToolbar, but am unable to do this, wasting some valuable space.
The ACToolbar has no logo.
How can I place this panel flush to the left?

B4X:
Sub Globals()
    Private ActionBar As ACToolBarLight
    Private pnlActionbar As Panel
End Sub

Sub Activity_Create(bFirstTime As Boolean)
    pnlActionbar.Initialize("pnlActionbar")
    
    btnMenuGroupDown.Initialize("btnMenuGroupDown")
    btnMenuGroupDown.TextSize = 18
    btnMenuGroupDown.TextColor = Colors.RGB(255, 0, 0)
    btnMenuGroupDown.Gravity = Gravity.CENTER
    btnMenuGroupDown.Color = Colors.ARGB(0, 255, 255, 32) 'yellow
    pnlActionbar.AddView(btnMenuGroupDown, 0, 0, 60dip, 44dip)
        
    btnMenuGroupUp.Initialize("btnMenuGroupUp")
    btnMenuGroupUp.Color = Colors.ARGB(0, 255, 255, 32) 'yellow
    pnlActionbar.AddView(btnMenuGroupUp, 61dip, 0, 60dip, 44dip)
    
    btnDroppyAnchor.Initialize("btnDroppyAnchor")
    btnDroppyAnchor.Color = Colors.ARGB(0,255, 255, 32) 'color of actionbar
    btnDroppyAnchor.Visible = True 'needs to be visible to anchor to the button
    pnlActionbar.AddView(btnDroppyAnchor, 104dip, 40dip, 1dip, 1dip)
    
    ActionBar.Title = ""
    ActionBar.Color = Colors.RGB(255, 255, 32) 'yellow

    ActionBar.AddView(pnlActionbar, 120dip, 44dip, Gravity.LEFT)
End Sub

RBS
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1609135656395.png


B4X:
ACToolBarLight1.AddView(b, 100dip, 50dip, Gravity.LEFT) 'b = button
Dim jo As JavaObject = b.Parent
jo.RunMethod("setContentInsetsAbsolute", Array(0, 0))
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
View attachment 105003

B4X:
ACToolBarLight1.AddView(b, 100dip, 50dip, Gravity.LEFT) 'b = button
Dim jo As JavaObject = b.Parent
jo.RunMethod("setContentInsetsAbsolute", Array(0, 0))

Thanks, that works very nice indeed.
I improved further by not having the 2 buttons (first one holding the menu item name), but instead a panel with a transparent label
holding the menu item name. I can move menu group up or down via the panel touch event, touch the panel either left side or right side.
BTW, it would be very nice if there was a library holding all those useful Java methods/properties.

RBS
 
Upvote 0
Top