Android Question Differences between Navigation Items in Corwin Material Design Wrapper

Discussion in 'Android Questions' started by CanguroCode, May 10, 2015.

  1. CanguroCode

    CanguroCode Active Member Licensed User

    I have followed and successfully implemented the following @corwin42 post's:

    http://www.b4x.com/android/forum/threads/material-design-1-basics.48077/
    http://www.b4x.com/android/forum/threads/material-design-2-using-the-appcompat-library.48424/
    http://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:

    Code:
    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, 
    00100%x56dip)
           bd = xml.GetDrawable(
    "ic_menu_white_24dp")
           ActionBar.NavigationIconDrawable=bd
           ActionBar.InitMenuListener
    End Sub

    Private Sub ActionBar_NavigationItemClick
          
    ToastMessageShow("Click"True)
    End Sub
    This works well. And I get the following:

    [​IMG]

    Alternatively I can also use the following code and get the same result:

    Code:
    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, 
    00100%x56dip)
           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:

    Code:
    ActionBar.NavigationIconDrawable=bd
    And

    Code:
    ABHelper.UpIndicatorDrawable=bd
    ABHelper.ShowUpIndicator = 
    True
    What is the proper way to use this component?
     
    Last edited: May 10, 2015
  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    If I am not wrong, they are both correct.
    ACActionBar exposes the current activity's actionbar related properties. Once you set ActionBar.SetAsActionBar, then ACActionBar will point to this actionbar/toolbar. (A toolbar is a toolbar until set as an actionbar, if that makes sense).
     
    DonManfred and Peter Simpson like this.
  3. CanguroCode

    CanguroCode Active Member Licensed User

    Thanks!, So, both codes are the same element?
     
  4. phukol

    phukol Active Member Licensed User

    Good day im experiencing error unknown type acactionbar. i tried searching everywhere here but i didnt find any jar file for acactionbar. where can i download this file?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice