B4A Library AppCompat - Make Material Design apps compatible with older Android versions

Reids

Member
Licensed User
The bug will be fixed for the next version but it will take some time for the release. I'm currently on vacation and have only a Netbook with me. Running Eclipse on it is not much fun. :eek:
Finally the actiobar_NavigationItemClick got working,this event is enough to solve this problem :D
Thank You Very Much!, have a good day there~
 

dragonguy

Active Member
Licensed User
if I have two activity - Main, Second, can I set different color for two activity?

colorPrimaryDark value only can set in Main activity but how can i set Second activity colorPrimaryDark value?
 

corwin42

Expert
Licensed User
if I have two activity - Main, Second, can I set different color for two activity?

colorPrimaryDark value only can set in Main activity but how can i set Second activity colorPrimaryDark value?
Use two themes and set each theme to one activity:

B4X:
'For all other activities
SetApplicationAttribute(android:theme, "@style/Theme.AppCompat")

'Different themes for special activities
SetActivityAttribute(Main, android:theme, "@style/MyAppTheme1")
SetActivityAttribute(Second, android:theme, "@style/MyAppTheme2")

CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme1" parent="@style/Theme.AppCompat">
        <item name="colorPrimary">#FF9800</item>
        <item name="colorPrimaryDark">#F57C00</item>
        <item name="colorAccent">#FFA726</item>
    </style>
    <style name="MyAppTheme2" parent="@style/Theme.AppCompat">
        <item name="colorPrimary">#009800</item>
        <item name="colorPrimaryDark">#007C00</item>
        <item name="colorAccent">#00A726</item>
    </style>
</resources>
 
Last edited:

MarcoRome

Expert
Licensed User
Hi @corwin42 .
Great library and thank you very much for this.
Anyway i see that using version 3.20 works without any problem on Android 5 or >. But crashes if you use Android 4 (which does not happen on the version 2 library that works on both Android version 4/5/6).
Any suggestion ?
 

chuath

Member
Licensed User
Hi @corwin42 .
Great library and thank you very much for this.
Anyway i see that using version 3.20 works without any problem on Android 5 or >. But crashes if you use Android 4 (which does not happen on the version 2 library that works on both Android version 4/5/6).
Any suggestion ?
I had this problem before and solved it with @corwin42's help on post #199
Follow the steps and it should be resolved.
particular this step
Check if the only existing folder in <SDK>\build-tools is the 23.0.3 folder.
 

Anser

Well-Known Member
Licensed User
Hi Corwin,

V3.30
  • New: Support for ActionViews in MenuItems (Needed for CustomViews in NavigationView of DesignSupport library)

With the new version of AppCompat V3.30, will it be possible to show a badge on the ACMenuItem displayed on the ToolBar as shown on the below given post ?

https://www.b4x.com/android/forum/threads/show-badge-on-acmenuitem-shown-on-toolbar.68900/#post-446042

I have seen many apps with this feature, unfortunately, till now, I could not find any other way to get this done on my app. Or am I in the wrong track to get this done ?

Regards

Anser
 
Last edited:

corwin42

Expert
Licensed User
Hi Corwin,




With the new version of AppCompat V3.30, will it be possible to show a badge on the ACMenuItem displayed on the ToolBar as shown on the below given post ?

https://www.b4x.com/android/forum/threads/show-badge-on-acmenuitem-shown-on-toolbar.68900/#post-446042
Yes. It should be possible to put nearly every View as an ActionView to the ActionBar/ToolBar now.

Hello! Is there a way to change the corner radius and elevation for ACButton?
You can't change the corner radius because it is in the default background drawable of the button.
You can change the Elevation of every view with the AppCompat.SetElevation() method (on some view types this won't have an effect but ACButton should work).
 

shashkiranr

Active Member
Licensed User
Hi All,

I am using ACCheckbox and I want it to be in a custom white color. I am using the below method to set the checked color given in the link https://www.b4x.com/android/forum/threads/checkbox-checked-color.61779/#content
B4X:
'Pass the Checkbox object and Colors int values to set for each state.
Sub SetColorTintList(CB As CheckBox,Checked As Int,Enabled As Int,Disabled As Int)

    Dim States(3,1) As Int

    States(0,0) = 16842912   'Checked
    States(1,0) = 16842910    'Enabled
    States(2,0) = -16842910 'Disabled


    Dim Color(3) As Int = Array As Int(Checked,Enabled,Disabled)

    Dim CSL As JavaObject
    CSL.InitializeNewInstance("android.content.res.ColorStateList",Array As Object(States,Color))
    Dim CB1 As JavaObject = CB
    CB1.RunMethod("setButtonTintList",Array As Object(CSL))

End Sub
It works great on Android 5 and 6 but I am getting the below error in honor4x Android 4.4.4

B4X:
Exception java.lang.RuntimeException: Method: setButtonTintList not found in: android.support.v7.widget.AppCompatCheckBox
I checked the google devloper website and the method does not exists but an inherited xml from compactbutton class is present. Any idea what can be done.

https://developer.android.com/reference/android/support/v7/widget/AppCompatCheckBox.html

Best,
SK
 

Reids

Member
Licensed User
Hi corwin, it seem the appacompat lib has a bug in .ButtonColor properties on version 36 google support library, which button displayed as gray button but
on previous version of 23 google support library button working nicely *this problem occured in android version 4, which not occured on version 6.
Oh if you suggest me to use .color properties the button will have bigger padding which is not elegant
your appcompat library ACbutton has .ButtonColor properties which is very cool!
I forced to use version 36 because design support require support lib of version 36

Thanks
 

roberto64

Active Member
Licensed User
Are you using a light or dark Theme? It should be ok if you use a light theme.
hello Corwin42, in ACEditText InputType Phone ownership and Numeric, the keypad appears with letters instead of the keyboard with the numbers?
thank youh
 
Top