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,332
  • FloatLabelEditText1_0.zip
    8.2 KB · Views: 1,063
  • FloatingActionButton1_0.zip
    12.5 KB · Views: 1,165
  • ScrollingTabsExample2_00.zip
    8.3 KB · Views: 1,166
  • SnackBarExample2_00.zip
    7.7 KB · Views: 1,073
  • TabsWithCustomViewExample2_0.zip
    24.5 KB · Views: 1,278
  • NavigationView1_0.zip
    108.9 KB · Views: 1,875
  • BottomNavigationViewExample1_0.zip
    28.7 KB · Views: 1,162
  • DesignSupportLib2_31.zip
    58.3 KB · Views: 780
  • DesignSupportLib2_32.zip
    58.3 KB · Views: 1,496
  • DesignSupportLib3_00.zip
    65.9 KB · Views: 1,503
Last edited:

Lello1964

Well-Known Member
Licensed 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?
 

ernschd

Active Member
Licensed User
I have an error when I'm trying to compile ScrollingTabs example:

B4X:
B4A Version: 10.2
Java Version: 8
Parse den Code.    (0.00s)
Building folders structure.    (0.03s)
Kompiliere den Code.    (0.01s)
Kompiliere Layoutcode.    (0.00s)
Organisiere Libraries.    (0.00s)
    (AndroidX SDK)
Generiere R Datei.    (0.00s)
Kompiliere generierten Java Code.    Error
B4A line: 57
TabLayout.SetViewPager(VP)
javac 1.8.0_241
src\example\tablayout\scrollingtabs\main.java:380: error: cannot access ViewPager
mostCurrent._tablayout.SetViewPager((androidx.viewpager.widget.ViewPager)(mostCurrent._vp.getObject()));
                      ^
  class file for android.support.v4.view.ViewPager not found
1 error

I'm using AppCompat Version 4, DesignSupport Library and AHViewPager Version 3
android.jar is Version 29
 

tuhatinhvn

Active Member
Licensed User
I have an error when I'm trying to compile ScrollingTabs example:

B4X:
B4A Version: 10.2
Java Version: 8
Parse den Code.    (0.00s)
Building folders structure.    (0.03s)
Kompiliere den Code.    (0.01s)
Kompiliere Layoutcode.    (0.00s)
Organisiere Libraries.    (0.00s)
    (AndroidX SDK)
Generiere R Datei.    (0.00s)
Kompiliere generierten Java Code.    Error
B4A line: 57
TabLayout.SetViewPager(VP)
javac 1.8.0_241
src\example\tablayout\scrollingtabs\main.java:380: error: cannot access ViewPager
mostCurrent._tablayout.SetViewPager((androidx.viewpager.widget.ViewPager)(mostCurrent._vp.getObject()));
                      ^
  class file for android.support.v4.view.ViewPager not found
1 error

I'm using AppCompat Version 4, DesignSupport Library and AHViewPager Version 3
android.jar is Version 29
You need JettyFile using ANdroidx not Android
 

delgadol

Member
today i update my sdk, whith material 1.3, the code that include this library cras and no compiled


thanks in advance.
 

Attachments

  • error_lib_design_support.PNG
    error_lib_design_support.PNG
    37.8 KB · Views: 84

Rubsanpe

Active Member
Licensed User
today i update my sdk, whith material 1.3, the code that include this library cras and no compiled


thanks in advance.

Hi, look at this

Rubén
 

delgadol

Member
Hi, look at this

Rubén

this is the new package, i restore my sdk from backup, and all be ok again. but with this new update, we can not compile new apk from older source code with this library
 

Attachments

  • errpr_desing.PNG
    errpr_desing.PNG
    39.1 KB · Views: 95

Rubsanpe

Active Member
Licensed User
Hi, I also always update everything to the latest versions with the SDK Manager. As it has been made clear in the thread I have referred you to, you should only download the artifacts that compile tells you that they are missing. If you update everything it can happen that an update is no longer compatible with what you had until that moment.

Rubén
 

Abdou1283

Member
Licensed User
Hi, after update to b4a 10.7 beta #1, i get this error
B4X:
java.lang.NoSuchFieldError: No static field navdrawer_layout of type I in class Lanywheresoftware/b4a/objects/R$layout; or its superclasses (declaration of 'anywheresoftware.b4a.objects.R$layout' appears in /data/app/com.royal.streaming--wzVsrCFObwRMz2djCN0AA==/base.apk)
Could abyone help me, please. i'm using appcompat 4.0 and designsupport 3.0
 
Last edited:
hello,
I tried all example on Android api 30 & java jdk-11.0.1 but getting errors. i am using B4a 10.7 version
For example if i try to run BottomNavigationView example . I am getting error as shown in image. I searched forum but cant understand how to relove it

Your help will be highly appreciable to resolve the same
 

Attachments

  • error.jpg
    error.jpg
    75.4 KB · Views: 76

so27

Active Member
Licensed User
hello,
I tried all example on Android api 30 & java jdk-11.0.1 but getting errors. i am using B4a 10.7 version
For example if i try to run BottomNavigationView example . I am getting error as shown in image. I searched forum but cant understand how to relove it

Your help will be highly appreciable to resolve the same

This library is not yet compatible with AndroidX and does not work from B4a10.7 at the moment.

See here.
 
This library is not yet compatible with AndroidX and does not work from B4a10.7 at the moment.

See here.
Thanks for your refence. But as per same post it says AppCompat works fine. and this is based on AppCompat library only so it should work is what my understanding.
Please correct me if i am wrong?
Once again thanks for your valuable response
 

Spavlyuk

Member
Licensed User
I found a workaround with a bit of Erel's help.

With a tool such as 7-zip, open DesignSupport.aar and/or DesignSupport.androidx.aar.
Select AndroidManifest.xml and click on File -> View.
Edit the package to "de.amberhome.objects", save the file and close the editor.
7-zip should now prompt you to re-archive the aar file with the modified contents. Click yes to confirm.
Clean the project and/or restart b4a.

I had to do that only for DesignSupport.aar to get it working. I can't tell if it's a good idea but it should work as a temporary solution.

In any case, since google is no longer updating the design support library it's probably best you migrate to a different library or write your own wrapper of material components like I'm doing.
 
I found a workaround with a bit of Erel's help.

With a tool such as 7-zip, open DesignSupport.aar and/or DesignSupport.androidx.aar.
Select AndroidManifest.xml and click on File -> View.
Edit the package to "de.amberhome.objects", save the file and close the editor.
7-zip should now prompt you to re-archive the aar file with the modified contents. Click yes to confirm.
Clean the project and/or restart b4a.

I had to do that only for DesignSupport.aar to get it working. I can't tell if it's a good idea but it should work as a temporary solution.

In any case, since google is no longer updating the design support library it's probably best you migrate to a different library or write your own wrapper of material components like I'm doing.

Thanks
But i did the same but no success, I have both DesignSupport.aar and DesignSupport.androidx.aar file in my additional library.
Can you please share both this modified lib with your test code ,i will check same at my end?

Once again thanks for your responce
 

so27

Active Member
Licensed User
I found a workaround with a bit of Erel's help.

With a tool such as 7-zip, open DesignSupport.aar and/or DesignSupport.androidx.aar.
Select AndroidManifest.xml and click on File -> View.
Edit the package to "de.amberhome.objects", save the file and close the editor.
7-zip should now prompt you to re-archive the aar file with the modified contents. Click yes to confirm.
Clean the project and/or restart b4a.

I had to do that only for DesignSupport.aar to get it working. I can't tell if it's a good idea but it should work as a temporary solution.

In any case, since google is no longer updating the design support library it's probably best you migrate to a different library or write your own wrapper of material components like I'm doing.

Thanks for the tip. It works for me. Now when I run the Jetifier, it wants to modify DesignSupport.aar. Do it or don't do it?
 

Attachments

  • screenshot_03_14042021.png
    screenshot_03_14042021.png
    10.8 KB · Views: 69
Top