Android Example AppCompat with ToolBar - minimal example

Status
Not open for further replies.

Erel

Administrator
Staff member
Licensed User
appcompat.gif




The project attached uses the powerful AppCompat library to replace the built-in ActionBar with a more robust ToolBar.

The NavigationItemClick event is raised when the icon is clicked.

You can set ToolbarHelper.ShowUpIndicator = True to show an up arrow instead. It will raise the same event.



You can change the toolbar color in the manifest editor.

Sliding side menu + dynamic menu items: https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/#post-509530



Example based on B4ADrawer: https://www.b4x.com/android/forum/threads/class-b4adrawer-sliding-drawer.97828/#post-616518

 

Attachments

Last edited:

vfafou

Active Member
Licensed User
Hello!
When I try to compile, I'm getting the following error:
B4X:
B4A version: 7.01
Parsing code.    (0.00s)
Compiling code.    (0.15s)
Compiling layouts code.    (0.02s)
Organizing libraries.    (0.00s)
Generating R file.    Error
C:\Users\VF\Desktop\AppCompatWithSlidingMenu\AppCompat\Objects\bin\extra\res3\res\values-v24\values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
C:\Users\VF\Desktop\AppCompatWithSlidingMenu\AppCompat\Objects\bin\extra\res3\res\values-v24\values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
Any suggestion?

Thank you in advance!
 

little3399

Active Member
Licensed User
AppCompatWithDynamicMenuAndBadge DEMO program, can't seem to run? Are there any requirements for the Android version?

because it run once , it will go back to the os ...
 

Erel

Administrator
Staff member
Licensed User
Now with a more colorful popup menu:



The color is set in the manifest editor:
B4X:
<style name="ToolbarMenu" parent="Base.ThemeOverlay.AppCompat.ActionBar">
    <item name="android:textColorPrimary">#fff</item>
    <item name="android:colorBackground">#0098FF</item>
   </style>
And is set with this code:
B4X:
Dim jo As JavaObject = ACToolBarLight1
Dim xl As XmlLayoutBuilder
jo.RunMethod("setPopupTheme", Array(xl.GetResourceId("style", "ToolbarMenu")))
 

Attachments

Cassie

Member
Licensed User
Hi Guys,

any idea what could this error be "invalid resource directory name: C:\Users\Admin\Documents\Tutorials And Samples\B4a Samples\AppCompatWithDynamicMenuAndBadge\AppCompat\Objects\bin\extra\res2\res/values-b+sr+Latn"

Thanks
 
Status
Not open for further replies.
Top