B4A Library DesignSupport - Additional Material Design components

This library is a wrapper to some of the objects of Googles Design Support library.

Requirements:

This library requires B4A 6.31 or above.
From V2.32 on B4A V6.80 or newer is required. If you use an older B4A version use the V2.31 library.
AppCompat 3.30 or above is required.
The examples need some additional libraries like AHViewPager, XMLViewEx, XMLLayoutBuilder

Currently it supports:
  • Snackbar - The new modern toastmessages
    Screenshot_20151001-110844.png
  • TabLayout - The new material like tabs with fixed tabs and scrolling tabs feature. Works standalone or together with a ViewPager library. Supports icons as tabs and custom layouts for the tabs.
    Screenshot_20151001-110749.pngScreenshot_20151001-110809.png
  • FloatlabelEditText - An enhanced EditText object that supports a floating label, counter and error messages.
    Screenshot_20160624-105201.png
  • FloatingActionButton - A very simple Floating Action Button. Has show- and hide animations but is very simple.
    Screenshot_20160624-104708.png
  • NavigationDrawer - Material Design compliant Navigation Drawer. See NavigationView Example for detailed instructions.
    Screenshot_20160826-160906.png
  • BottomNavigationView - Material Design compliant Bottom Navigation View. See BottomNavigationView Example for detailed instructions.
    Screenshot_20161219-091326.png
Installation:
Note: Please, Please read these instructions carefully. AppCompat depends on many things like a special theme with special features. Even special versions of build tools are required and last but not least there are often bugs in the Google support libraries.

I created this instructions to help you getting things ready for using AppCompat. So please follow these instructions carefully and all should work as expected and you don't have to ask in the forum.

Thanks.
  1. This library depends on the AppCompat library. So do all the setup needed for AppCompat.
  2. Copy the DesignSupport.xml, DesignSupport.jar and DesignSupport.aar files to your CustomLibs folder
  3. Install/Update Android Support Packages with the SDK Manager.
Setup and usage:
  1. Setup your project like a project that uses AppCompat library.
If you want to use the DSFloatlabelEditText object with the ErrorText or counter feature you should add the following item to your Theme:
B4X:
<item name="textColorError">@color/design_textinput_error_color_light</item>
Otherwise your app will crash if the textinput reaches the maxCounter length.

If you want to use the DSNavigationDrawer object you should add the following items to your Theme:
B4X:
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>

Your support:
Creating libraries and wrappers for existing library projects is a lot of work. The use of this library is totally free and you even don't need to mention in your app that you use it.
But if you use this library in your projects and you think it is useful to you please consider to make a donation:

Thanks very much for your support.


Version History:

V1.00
  • Initial version with SnackBar and TabLayout objects.
V2.00
  • Requires B4A 6.0 or above
  • Uses new Maven repositories for support libraries
  • Enhanced Designer support (custom properties are supported)
  • New: DSFloatlabelEditText - New EditText with floating label, counter, error messages
  • New: DSFloatingActionButton - Standard Floating Action Button.
V2.10
  • New: Requires Support Repository 36
  • New: DSNavigationDrawer - A complete DrawerLayout implementation/wrapper
  • New: DSNavigationView
  • New: Support for ShowPasswordToggle in FloatLabelEditText
  • Fix: FloatLabelEditText.Enabled=True/False should work now.
V2.20
  • Fix: DSNavigationDrawer should work without a secondary drawer.
  • New: BottomNavigationView - Wrapper for the BottomNavigationView
  • Fix: Some minor fixes and changes
V2.21
  • Fix: DSTablayout can use other ViewPagers than AHViewPager
  • Fix: Small internal bugfixes.
V2.22
  • Fix: Change packagename to anywheresoftware.b4a.orbjects to reduce resouce fields
V2.23
  • Fix: Fix error in FloatLabelEditText
V2.30
  • New: Dismiss event for DSSnackbar
  • New: Support CharSequence where possible
V2.31
  • Fix: Getters return String instead of CharSequence to avoid problems.
V2.32
  • Fix: Compiled against B4A 6.80 Core library to avoid some problems with CharSequences.
V3.00
  • Fix: Compiled against Support Library 28.0.0 to fix a problem with TabLayout
 

Attachments

  • FixedTabsExample2_00.zip
    23.4 KB · Views: 1,981
  • FloatLabelEditText1_0.zip
    8.2 KB · Views: 1,620
  • FloatingActionButton1_0.zip
    12.5 KB · Views: 1,741
  • ScrollingTabsExample2_00.zip
    8.3 KB · Views: 1,748
  • SnackBarExample2_00.zip
    7.7 KB · Views: 1,610
  • TabsWithCustomViewExample2_0.zip
    24.5 KB · Views: 1,876
  • NavigationView1_0.zip
    108.9 KB · Views: 2,531
  • BottomNavigationViewExample1_0.zip
    28.7 KB · Views: 1,777
  • DesignSupportLib2_31.zip
    58.3 KB · Views: 1,416
  • DesignSupportLib2_32.zip
    58.3 KB · Views: 2,173
  • DesignSupportLib3_00.zip
    65.9 KB · Views: 2,444
Last edited:

Lello1964

Well-Known Member
Licensed User
Longtime User
I have updated to Android-28 sdk and cannot complie.
Have this error.

How can i do ???
 

Attachments

  • errore.png
    errore.png
    39.6 KB · Views: 404
  • errore1.png
    errore1.png
    55.1 KB · Views: 401

Roberto P.

Well-Known Member
Licensed User
Longtime User
It seems that google messed up something with the design-support dependencies.

I can confirm that I have this error, too. Currently I don't know of a fix for it.


Hello
I just updated sdk and it appeared error:


java.lang.NoSuchMethodError: No virtual method addOnTabSelectedListener(Landroid/support/design/widget/TabLayout$OnTabSelectedListener;)V in class Landroid/support/design/widget/TabLayout; or its super classes (declaration of 'android.support.design.widget.TabLayout' appears in /data/app/dev.meta.sb-2/base.apk:classes2.dex)
at de.amberhome.objects.TabLayoutWrapper.innerInitialize(TabLayoutWrapper.java:63)
at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:67)
at de.amberhome.objects.TabLayoutWrapper.Initialize(TabLayoutWrapper.java:52)
at dev.meta.sb.cuserinterface._initialize(cuserinterface.java:412)
at dev.meta.sb.main._activity_create(main.java:667)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at dev.meta.sb.main.afterFirstLayout(main.java:104)
at dev.meta.sb.main.access$000(main.java:17)
at dev.meta.sb.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6134)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

did you find the solution? Do you have any advice to give?

I'm blocked!

thank you
 

jimmyF

Active Member
Licensed User
Longtime User
I solved the update to Android 28 by downloading the entire, up-to-date, sdk from Google https://developer.android.com/studio/ (go to bottom of the page).
I extracted it completely to my b4a_sdk folder and overwrote everything.
I then ran my sdkManager, searched for Android Platform 28 and checked it, updated all, and and got everything working, including AH PageViewer, but excluding DSTabLayout, in my app.

DSTabLayout error: same as first post
 

scsjc

Well-Known Member
Licensed User
Longtime User
I solved the update to Android 28 by downloading the entire, up-to-date, sdk from Google https://developer.android.com/studio/ (go to bottom of the page).
I extracted it completely to my b4a_sdk folder and overwrote everything.
I then ran my sdkManager, searched for Android Platform 28 and checked it, updated all, and and got everything working, including AH PageViewer, but excluding DSTabLayout, in my app.

DSTabLayout error: same as first post

Any solution for DSTabLayout error with SDK28 ???
 

corwin42

Expert
Licensed User
Longtime User

corwin42

Expert
Licensed User
Longtime User
First post is updated with a new version which should fix the crash with 28.0.0 support library TabLayout.
 

scsjc

Well-Known Member
Licensed User
Longtime User
First post is updated with a new version which should fix the crash with 28.0.0 support library TabLayout.

Work Perfectly :)

̶O̶n̶e̶ ̶i̶d̶e̶a̶,̶ ̶i̶s̶ ̶p̶o̶s̶s̶i̶b̶l̶e̶ ̶a̶ ̶c̶h̶a̶n̶g̶e̶ ̶c̶o̶l̶o̶r̶t̶e̶x̶t̶ ̶o̶r̶ ̶b̶a̶c̶k̶g̶r̶o̶u̶n̶d̶c̶o̶l̶o̶r̶ ̶f̶r̶o̶m̶ ̶e̶s̶p̶e̶c̶i̶f̶i̶c̶ ̶t̶a̶b̶ ̶i̶n̶d̶e̶x̶?̶

Correct, there was already a way to do it, of course very good library

B4X:
Dim cs As CSBuilder
cs.Initialize.Color(colors.red).Append("TEXT").PopAll
TabLayout.SetTabText(1, cs)

Thank you
 
Last edited:

Scantech

Well-Known Member
Licensed User
Longtime User
still crashes with new update.

Installed v3.00 and crashes with both 27.1.1 and 28.0.0 support library

Update: I missed the appcompat update. i will try it later on
 
Last edited:

IlCasti

Active Member
Licensed User
Longtime User
How to set custom typeface to items in NavigationView?
How to change typeface font?
Thank you for helping me.
 

Pedro Hu

Member
thanks but now I get this error and I don't know how to solve it:
res\values\theme.xml:9: error: Error: No resource found that matches the given name: attr 'textColorError'.
Sorry I'm something new if this is very obvious.:(
 

Lello1964

Well-Known Member
Licensed User
Longtime User
Try to copy resource folder into your app folder.

The folder is inside demo app folder.
 

Pedro Hu

Member
I'm trying to compile the FloatingActionButton 1_0 example to understand how it works but the example gives me this error:
res \ values \ theme.xml: 9: error: Error: No resource found that matches the given name: attr 'textColorError'.
I don't know if I installed the library wrong or what should I do?
 
Top