I have followed and successfully implemented the following @corwin42 post's:
https://www.b4x.com/android/forum/threads/material-design-1-basics.48077/
https://www.b4x.com/android/forum/threads/material-design-2-using-the-appcompat-library.48424/
https://www.b4x.com/android/forum/threads/material-design-3-using-a-toolbar-as-actionbar.49053/
To add the icon navigation (burger icon) and click action, I use the following code in a Class:
This works well. And I get the following:
Alternatively I can also use the following code and get the same result:
What is the difference? between:
And
What is the proper way to use this component?
https://www.b4x.com/android/forum/threads/material-design-1-basics.48077/
https://www.b4x.com/android/forum/threads/material-design-2-using-the-appcompat-library.48424/
https://www.b4x.com/android/forum/threads/material-design-3-using-a-toolbar-as-actionbar.49053/
To add the icon navigation (burger icon) and click action, I use the following code in a Class:
B4X:
Sub Class_Globals
Private ActionBar As ACToolBarDark
Private ABHelper As ACActionBar
Private xml As XmlLayoutBuilder
Private bd As BitmapDrawable
End Sub
Public Sub Initialize(Activity1 As Activity)
ActionBar.Initialize("ActionBar")
ActionBar.SetAsActionBar
ActionBar.Title="The Title"
Activity1.AddView(ActionBar, 0, 0, 100%x, 56dip)
bd = xml.GetDrawable("ic_menu_white_24dp")
ActionBar.NavigationIconDrawable=bd
ActionBar.InitMenuListener
End Sub
Private Sub ActionBar_NavigationItemClick
ToastMessageShow("Click", True)
End Sub
Alternatively I can also use the following code and get the same result:
B4X:
Sub Class_Globals
Private ActionBar As ACToolBarDark
Private ABHelper As ACActionBar
Private xml As XmlLayoutBuilder
Private bd As BitmapDrawable
End Sub
Public Sub Initialize(Activity1 As Activity)
ActionBar.Initialize("ActionBar")
ActionBar.SetAsActionBar
ActionBar.Title="The Title"
Activity1.AddView(ActionBar, 0, 0, 100%x, 56dip)
bd = xml.GetDrawable("ic_menu_white_24dp")
ABHelper.Initialize
ABHelper.UpIndicatorDrawable=bd
ABHelper.ShowUpIndicator = True
ActionBar.InitMenuListener
End Sub
Private Sub ActionBar_NavigationItemClick
ToastMessageShow("Click", True)
End Sub
What is the difference? between:
B4X:
ActionBar.NavigationIconDrawable=bd
And
B4X:
ABHelper.UpIndicatorDrawable=bd
ABHelper.ShowUpIndicator = True
What is the proper way to use this component?
Last edited: