Android Question Change color of buttons in Msgbox2Async?

jo1234

Active Member
Licensed User
Longtime User
Hi,

how can I change the buttons in Msgbox2Async?
I use Erel's example https://www.b4x.com/android/forum/threads/theme-colors.87716/ to change the colors and added android:colorAccent, but did not manage to change the color of the buttons in the message box.

B4X:
SetApplicationAttribute(android:theme, "@style/LightTheme")
CreateResource(values, colors.xml,
<resources>
   <color name="textColorPrimary">#ff000000</color>
   <color name="actionbar">#ff039be5</color>
   <color name="statusbar">#ff006db3</color>
   <color name="navigationBar">#ff006db3</color>
</resources>
)

CreateResource(values-v20, theme.xml,
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Material.Light">
        <item name="android:colorPrimary">@color/actionbar</item>
        <item name="android:colorPrimaryDark">@color/statusbar</item>
        <item name="android:textColorPrimary">@color/textColorPrimary</item>
        <item name="android:navigationBarColor">@color/navigationBar</item>
       <item name="android:colorAccent">@color/navigationBar</item>
    </style>
</resources>
)

CreateResource(values-v14, theme.xml,
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Holo.Light">
       <item name="android:actionBarStyle">@style/CustomActionBarStyle</item>
    </style>
   <style name="CustomActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
       <item name="android:background">@color/actionbar</item>
   </style>
</resources>
)

Thanks a lot!
Johannes
 

jo1234

Active Member
Licensed User
Longtime User
Solved.

B4X:
CreateResource(values-v20, theme.xml,
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Material.Light">
        <item name="android:colorPrimary">@color/actionbar</item>
        <item name="android:colorPrimaryDark">@color/statusbar</item>
        <item name="android:textColorPrimary">@color/textColorPrimary</item>
        <item name="android:navigationBarColor">@color/navigationBar</item>
        <item name="android:colorAccent">@color/navigationBar</item>
        <item name="android:alertDialogTheme">@style/AlertDialogCustom</item>
    </style>

    <style name="AlertDialogCustom" parent="@android:style/Theme.Material.Light.Dialog.Alert">
      <item name="android:colorPrimary">@color/actionbar</item>
      <item name="android:colorAccent">@color/navigationBar</item>
    </style>
</resources>
 
Upvote 1
Top