Android Question [SOLVED] How to implement Click Handler on Title of ActionBar

JMB

Active Member
Licensed User
Hi there,

I am playing around with AppCompat and the ACtionToolBar - all very new!

I am trying to figure out how I would add a click handler to the Title part of an ActionBar?

Thank you.

JMB
 

JMB

Active Member
Licensed User
Thank you DonManfred. That was it.

Just thought I'd post my code in case anyone else was wondering...

Having added access to the AppCompat library, and using the following definitions,

B4X:
Private ActionBar As ACToolBarLight
Private ACTestButton As ACButton
Private ACTestFlatButton As ACFlatButton
the following code adds buttons to the Action Bar...

B4X:
ACTestButton.Initialize("TestButton")
ACTestButton.Text = "Test" & Chr(13) & "Button"
ACTestButton.ButtonColor = ActionBar.THEME_LIGHT
ACTestButton.TextColor = Colors.White
ActionBar.AddView(ACTestButton,120dip,56dip,Gravity.CENTER_VERTICAL)
  
ACTestFlatButton.Initialize("TestFlatButton")
ACTestFlatButton.Text = "Test Flat" & Chr(13) & "Button"
ACTestFlatButton.ButtonColor = ActionBar.THEME_LIGHT
ACTestFlatButton.TextColor = Colors.White
ActionBar.AddView(ACTestFlatButton,120dip,56dip,Gravity.CENTER_VERTICAL)
And the click handlers are..

B4X:
Sub TestButton_Click
   Log("TestButton Clicked")
End Sub

Sub TestFlatButton_Click
   Log("TestFlatButton Clicked")
End Sub
JMB
 
Top