Wish Implement Theme.MaterialComponents.*

zolive33

Active Member
Licensed User
Longtime User
Hi,

In reference to my question How to implement Theme.MaterialComponents.DayNight ?

Currently, it does not seem possible to use Material Design components for Android (https://material.io/). Probably there is a conflict between the android.support.* libraries, pre-defined for B4A, and those needed to implement the Theme.MaterialComponents.*.

Extract from Getting Started Guide : "Note: You should not use the com.android.support and com.google.android.material dependencies in your app at the same time."

In a future version of B4A, would it be possible to exploit the material.io components?

Best regards.
 

Spavlyuk

Active Member
Licensed User
It's possible to use material components right now but creating wrappers for them isn't that simple. Some Java knowledge is required to do that.

You can start with something simple, like a MaterialButton and expand to more complicated stuff like Snackbar, BottomNavigationView, MaterialDatePicker and TextInputLayout. I've created some of these for private use. Then there's stuff like NavigationView (navigation drawer) which are a lot more complicated.

If you're interested in making a wrapper, you can check the tutorials and try decompiling the existing AppCompat and DesignSupport libraries if you get stuck. Alternatively you could maybe post a job offer for someone else to create wrappers for the components that you need.

I haven't experimented with the DayNight theme, only using the default theme.

Manifest:
SetApplicationAttribute(android:theme, "@style/Theme.MaterialComponents")
 

zolive33

Active Member
Licensed User
Longtime User
It's possible to use material components right now but creating wrappers for them isn't that simple. Some Java knowledge is required to do that.

You can start with something simple, like a MaterialButton and expand to more complicated stuff like Snackbar, BottomNavigationView, MaterialDatePicker and TextInputLayout. I've created some of these for private use. Then there's stuff like NavigationView (navigation drawer) which are a lot more complicated.

If you're interested in making a wrapper, you can check the tutorials and try decompiling the existing AppCompat and DesignSupport libraries if you get stuck. Alternatively you could maybe post a job offer for someone else to create wrappers for the components that you need.

I haven't experimented with the DayNight theme, only using the default theme.

Manifest:
SetApplicationAttribute(android:theme, "@style/Theme.MaterialComponents")
Hi Spavlyuk,

Thank you for your quick response. I have already tried it, but the build crashes :
"AndroidManifest.xml:15: error: resource style/Theme.MaterialComponents (aka b4a.example:style/Theme.MaterialComponents) not found.
error: failed processing manifest."

I have decompiled the AppCompat library, but I don't understand how to make the link with Android themes. I have created many libraries in Java, but on this point I stall.

Best regards.
 
Last edited:
Top