Hii,
Which library to be included to use ACActionbar.?
Which library to be included to use ACActionbar.?
1. The question does not belong to this Thread.ACActionbar
item.visible = Falsehello, I need to switch from enable to disable an existing item in MaterialDrawer Menu. Is it possible? How Can I do this?
Also, is possible to hide an item from same Menu?
Thanks
#Region Project Attributes
#ApplicationLabel: AppCompatDrawer
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
'Theme Resources
#AdditionalRes: ..\resource
'MaterialDrawer Resources
#AdditionalRes: ..\md-lib\res
#AdditionalRes: ..\md-app\res
'Activity Type
#Extends: android.support.v7.app.ActionBarActivity
#AdditionalJar: com.android.support:design
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim AC As AppCompat
Dim ABHelper As ACActionBar
Private ActionBar As ACToolBarLight
Private pContent As Panel
Private cbABVisible As ACCheckBox
Dim MDB As MSMaterialDrawerBuilder
Dim MD As MSMaterialDrawer
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
'Set Title and Subtitle for the Toolbar
ActionBar.Title = "AppCompat"
ActionBar.SubTitle = "Toolbar Example 1"
'Because the Toolbar is part of out layout we split up our layout in a main layout file
'(which only has the Toolbar and a ContentPanel) and a content layout which has all the
'visible controls.
pContent.LoadLayout("content")
'sync the controls with current state of ActionBar/Toolbar
cbABVisible.Checked = True
ABHelper.Initialize
'The AppCompat object has some helper methods to get the height for StatusBar, ActionBar and NavigationBar.
'For the ActionBar there are two methods. GetStdActionBarHeight gets the standard ActionBar Height of the device.
'Be aware that this is not necessarily the height defined by the material design guidelines. There is a second
'method GetMaterialActionBarHeight which returns the ActionBar height as defined in the material design guidelines
'regardless of the Android version.
Log("ActionBar Height: " & (AC.GetMaterialActionBarHeight / DipToCurrent(1)))
'Add some MenuItems
'The best method to add action icons to the ActionBar/Toolbar is to load them as drawables.
'With this method it is possible to load icons in different resolutions taking care of the device scale.
'We use the XmlLayoutBuilder library to load the drawables.
Dim xml As XmlLayoutBuilder
Dim bd As BitmapDrawable
bd = xml.GetDrawable("ic_plus_one_black_24dp")
Activity.AddMenuItem3("Plus one", "Menu", bd.Bitmap, True)
bd = xml.GetDrawable("ic_refresh_black_24dp")
Activity.AddMenuItem3("Refresh", "Menu", bd.Bitmap, True)
Activity.AddMenuItem("Overflow1", "Menu")
Activity.AddMenuItem("Overflow2", "Menu")
Activity.AddMenuItem("Overflow3", "Menu")
BuildDrawer
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
'Show/Hide the Toolbar. This is done with the new SetLayoutAnimated and SetVisibleAnimated methods of B4A 4.0
Sub cbABVisible_CheckedChange(Checked As Boolean)
If Checked Then
ActionBar.SetLayoutAnimated(200, 0, 0, 100%x, AC.GetMaterialActionBarHeight)
ActionBar.SetVisibleAnimated(200, True)
pContent.SetLayoutAnimated(200, 0, AC.GetMaterialActionBarHeight, 100%x, 100%y - AC.GetMaterialActionBarHeight)
Else
ActionBar.SetLayoutAnimated(200, 0, 0, 100%x, 1dip)
ActionBar.SetVisibleAnimated(200, False)
pContent.SetLayoutAnimated(200, 0, 0, 100%x, 100%y)
End If
End Sub
'Handle Menu Click events. These are the normal B4A Menu item click events.
Sub Menu_Click
Log("MenuItem " & Sender & " selected")
End Sub
Sub BuildDrawer
Dim pnlHdr As Panel
pnlHdr.Initialize("")
pnlHdr.Color = Colors.DarkGray
pnlHdr.Tag = "Header"
MDB.Initialize("MD")
MDB.withHeader(pnlHdr, -1, 80dip)
MDB.AddPrimaryDrawerItem ("Weather" , Null ,Null ,"99+" ,True,1, "Shows the weather")
MDB.AddPrimaryDrawerItem ("Insanity" , Null ,Null ,"2" ,True,2, "")
MDB.AddPrimaryDrawerItem ("Awesome" , Null ,Null ,"" ,True,2, "")
MDB.AddSectionDrawerItem ("Section" ,True)
MDB.AddSecondaryDrawerItem("Settings" ,Null ,Null ,"" ,True ,3)
MDB.AddSecondaryDrawerItem("Help" ,Null ,Null ,"" ,True ,4)
MDB.AddSecondaryDrawerItem("Donate" ,Null,Null ,"" ,False,5)
MDB.AddSecondaryDrawerItem("Yo" ,Null ,Null ,"" ,False,6)
MD = MDB.Build
End Sub
CallSubDelayed(Me,"FlashFooter")
Sub FlashFooter
pnlFooter.Visible = False
pnlFooter.Visible = True
End Sub
Sub BuildDrawer
Dim MSP1 As MSProfile
Dim PDB1 As BitmapDrawable : PDB1.Initialize(LoadBitmap(File.DirAssets,"profile2.jpg"))
MSP1.withName("tds1111").withEmail("h@g.com").withIcon(PDB1).withSelectable(True)
MSP1.Identifier=999
Dim Profiles(2) As MSProfile
Profiles(0) = MSP1
Dim msa As MSAccountHeaderBuilder
Dim HeaderBackground As BitmapDrawable
HeaderBackground.Initialize(LoadBitmap(File.DirAssets,"header.jpg"))
msa.Initialize("MSA")
msa.addProfiles(Profiles)
msa.withAlternativeProfileHeaderSwitching(True)
msa.withHeaderBackground(HeaderBackground)
Dim MaterialHeaderResult As Object = msa.build
Dim p1 As MSIconicDrawable : p1.Initialize("gmd_home") : p1.Color = 0xffff4081
MDB.Initialize("MD")
MDB.withHeaderClickable(True)
MDB.withAccountHeader(MaterialHeaderResult)
'MDB.withHeader(pnlHdr, -1, 80dip)
MDB.AddPrimaryDrawerItem ("Weather" , p1.Drawable ,Null ,"99+" ,True,1, "Shows the weather")
MDB.withToolbar(ActionBar)
MDB.withActionbarToggle(True)
MDB.withActionbarToggleAnimated(True)
MD = MDB.Build
End Sub
Sub MSA_ProfileClicked (Profile As MSProfile )
Log(Profile.Name)
End Sub
MDB.withTransluscentStatusbar(False)Hello,
I'm testing the AppCompatDrawer example and all works fine except for a white band showed at the bottom when the app starts View attachment 53764
If I click on the checkbox, or I slide the drawer, the band disappear! View attachment 53765.
I think it's something related to the drawer because if I comment the Sub that create the drawer (BuildDrawer) no white band is showed.
I have colored the "content" layout background to highlight the band.
It's not really a big problem but I'd like to understand what's that band.
Any suggestion is wellcome, thanks!
this is the code:
B4X:#Region Project Attributes #ApplicationLabel: AppCompatDrawer #VersionCode: 1 #VersionName: 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: unspecified #CanInstallToExternalStorage: False #End Region 'Theme Resources #AdditionalRes: ..\resource 'MaterialDrawer Resources #AdditionalRes: ..\md-lib\res #AdditionalRes: ..\md-app\res 'Activity Type #Extends: android.support.v7.app.ActionBarActivity #AdditionalJar: com.android.support:design #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim AC As AppCompat Dim ABHelper As ACActionBar Private ActionBar As ACToolBarLight Private pContent As Panel Private cbABVisible As ACCheckBox Dim MDB As MSMaterialDrawerBuilder Dim MD As MSMaterialDrawer End Sub Sub Activity_Create(FirstTime As Boolean) 'Do not forget to load the layout file created with the visual designer. For example: Activity.LoadLayout("main") 'Set Title and Subtitle for the Toolbar ActionBar.Title = "AppCompat" ActionBar.SubTitle = "Toolbar Example 1" 'Because the Toolbar is part of out layout we split up our layout in a main layout file '(which only has the Toolbar and a ContentPanel) and a content layout which has all the 'visible controls. pContent.LoadLayout("content") 'sync the controls with current state of ActionBar/Toolbar cbABVisible.Checked = True ABHelper.Initialize 'The AppCompat object has some helper methods to get the height for StatusBar, ActionBar and NavigationBar. 'For the ActionBar there are two methods. GetStdActionBarHeight gets the standard ActionBar Height of the device. 'Be aware that this is not necessarily the height defined by the material design guidelines. There is a second 'method GetMaterialActionBarHeight which returns the ActionBar height as defined in the material design guidelines 'regardless of the Android version. Log("ActionBar Height: " & (AC.GetMaterialActionBarHeight / DipToCurrent(1))) 'Add some MenuItems 'The best method to add action icons to the ActionBar/Toolbar is to load them as drawables. 'With this method it is possible to load icons in different resolutions taking care of the device scale. 'We use the XmlLayoutBuilder library to load the drawables. Dim xml As XmlLayoutBuilder Dim bd As BitmapDrawable bd = xml.GetDrawable("ic_plus_one_black_24dp") Activity.AddMenuItem3("Plus one", "Menu", bd.Bitmap, True) bd = xml.GetDrawable("ic_refresh_black_24dp") Activity.AddMenuItem3("Refresh", "Menu", bd.Bitmap, True) Activity.AddMenuItem("Overflow1", "Menu") Activity.AddMenuItem("Overflow2", "Menu") Activity.AddMenuItem("Overflow3", "Menu") BuildDrawer End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub 'Show/Hide the Toolbar. This is done with the new SetLayoutAnimated and SetVisibleAnimated methods of B4A 4.0 Sub cbABVisible_CheckedChange(Checked As Boolean) If Checked Then ActionBar.SetLayoutAnimated(200, 0, 0, 100%x, AC.GetMaterialActionBarHeight) ActionBar.SetVisibleAnimated(200, True) pContent.SetLayoutAnimated(200, 0, AC.GetMaterialActionBarHeight, 100%x, 100%y - AC.GetMaterialActionBarHeight) Else ActionBar.SetLayoutAnimated(200, 0, 0, 100%x, 1dip) ActionBar.SetVisibleAnimated(200, False) pContent.SetLayoutAnimated(200, 0, 0, 100%x, 100%y) End If End Sub 'Handle Menu Click events. These are the normal B4A Menu item click events. Sub Menu_Click Log("MenuItem " & Sender & " selected") End Sub Sub BuildDrawer Dim pnlHdr As Panel pnlHdr.Initialize("") pnlHdr.Color = Colors.DarkGray pnlHdr.Tag = "Header" MDB.Initialize("MD") MDB.withHeader(pnlHdr, -1, 80dip) MDB.AddPrimaryDrawerItem ("Weather" , Null ,Null ,"99+" ,True,1, "Shows the weather") MDB.AddPrimaryDrawerItem ("Insanity" , Null ,Null ,"2" ,True,2, "") MDB.AddPrimaryDrawerItem ("Awesome" , Null ,Null ,"" ,True,2, "") MDB.AddSectionDrawerItem ("Section" ,True) MDB.AddSecondaryDrawerItem("Settings" ,Null ,Null ,"" ,True ,3) MDB.AddSecondaryDrawerItem("Help" ,Null ,Null ,"" ,True ,4) MDB.AddSecondaryDrawerItem("Donate" ,Null,Null ,"" ,False,5) MDB.AddSecondaryDrawerItem("Yo" ,Null ,Null ,"" ,False,6) MD = MDB.Build End Sub
--------- beginning of crash
java.lang.IllegalArgumentException: Invalid Layer Save Flag - only ALL_SAVE_FLAGS is allowed
at android.graphics.Canvas.checkValidSaveFlags(Canvas.java:378)
at android.graphics.Canvas.saveLayer(Canvas.java:455)
at com.mikepenz.materialdrawer.view.BezelImageView.onDraw(BezelImageView.java:209)
at android.view.View.draw(View.java:20207)
at android.view.View.updateDisplayListIfDirty(View.java:19082)
at android.view.View.draw(View.java:19935)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.view.View.updateDisplayListIfDirty(View.java:19073)
at android.view.View.draw(View.java:19935)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.view.View.draw(View.java:20210)
at android.view.View.updateDisplayListIfDirty(View.java:19082)
at android.view.View.draw(View.java:19935)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.view.View.updateDisplayListIfDirty(View.java:19073)
at android.view.View.draw(View.java:19935)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.widget.ListView.drawChild(ListView.java:3590)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:2639)
at android.widget.ListView.dispatchDraw(ListView.java:3585)
at android.view.View.draw(View.java:20210)
at android.widget.AbsListView.draw(AbsListView.java:4320)
at android.view.View.updateDisplayListIfDirty(View.java:19082)
at android.view.View.draw(View.java:19935)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.view.View.draw(View.java:20210)
at android.view.View.updateDisplayListIfDirty(View.java:19082)
at android.view.View.draw(View.java:19935)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1379)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.view.View.updateDisplayListIfDirty(View.java:19073)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4317)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4290)
at android.view.View.updateDisplayListIfDirty(View.java:19042)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4317)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4290)
at android.view.View.updateDisplayListIfDirty(View.java:19042)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4317)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4290)
at android.view.View.updateDisplayListIfDirty(View.java:19042)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4317)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4290)
at android.view.View.updateDisplayListIfDirty(View.java:19042)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4317)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4290)
at android.view.View.updateDisplayListIfDirty(View.java:19042)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:686)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:692)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:801)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:3311)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3115)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2484)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7183)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
at android.view.Choreographer.doCallbacks(Choreographer.java:761)
at android.view.Choreographer.doFrame(Choreographer.java:696)
at android.view.Chore
Message longer than Log limit (4000). Message was truncated.
** Activity (home) Resume **
Error occurred on line: 485 (Home)
android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.v4.widget.DrawerLayout
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.v4.widget.DrawerLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.widget.DrawerLayout" on path: DexPathList[[zip file "/data/app/ir.whtapp.groupwhatsapp-Z7dJSzAA4hmKRk-3dA5UtA==/base.apk"],nativeLibraryDirectories=[/data/app/ir.whtapp.groupwhatsapp-Z7dJSzAA4hmKRk-3dA5UtA==/lib/arm64, /system/lib64, /system/vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.view.LayoutInflater.createView(LayoutInflater.java:606)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.mikepenz.materialdrawer.Drawer.withDrawerLayout(Drawer.java:334)
at com.mikepenz.materialdrawer.Drawer.build(Drawer.java:1090)
at com.maximussoft.msmaterialdrawer.MSMaterialDrawerBuilder.Build(MSMaterialDrawerBuilder.java:122)
at ir.whtapp.groupwhatsapp.home._activity_resume(home.java:1301)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:176)
at ir.whtapp.groupwhatsapp.home.afterFirstLayout(home.java:110)
at ir.whtapp.groupwhatsapp.home.access$000(home.java:17)
at ir.whtapp.groupwhatsapp.home$WaitForLayout.run(home.java:82)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:169)
at android.app.ActivityThread.main(ActivityThread.java:6521)
update SDk and resolve problem
![]()