Android Question How to set MsgBox background color in MANIFEST EDITOR

mohdosala

Member
Hey there,
I'm changing the whole theme of my app using the method that Erel has posted in this thread: Theme Colors

Here is the code of my manifest editor:
Manifest Editor:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'CreateResourceFromFile(Macro, Themes.LightTheme)
SetApplicationAttribute (android:supportsRtl, true)
'End of default text.
SetApplicationAttribute(android:theme, "@style/LightTheme")
CreateResource(values, colors.xml,
<resources>
    <color name="actionbar">#43a047</color>
   <color name="statusbar">#00701a</color>
   <color name="textColorPrimary">#ffffffff</color>
   <color name="navigationBar">#00701a</color>
</resources>
)
CreateResource(values, 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:itemBackground">@color/actionbar</item>
        <item name="android:textColorPrimary">@color/textColorPrimary</item>
        <item name="android:navigationBarColor">@color/navigationBar</item>
    </style>
</resources>
)

And that works perfect! But the problem is that I don't know how to change MsgBox background to "actionbar" color.
Here is the result: as you can see, the text inside the MsgBox can't be read due to its color. I'm OK with the text color to be white. Since probably it's getting its color from "textColorPrimary" I'm trying to change the background of MsgBox.




in fact I'm looking for the value which is used after the word "android".

What to write after android:....:
<item name="android:(((MSGBOXBACKGROUNDCOLOR)))">@color/navigationBar</item>

BTW, how can I use material icon for action bar icon?

Sorry if my question got too long.
 

mohdosala

Member
I went through this directory on my pc
Directory:
C:\Android\platforms\android-33\data\res\values\themes-device-defaults.xml

I assume that the file above is the file which being read while compiling and if there's anything mentioned in the manifest of b4a, it'll override the the related ones in the xml file in that directory.

So I tried to call many of the values in that xml file in my manifest editor to see what would happen if I changed them.

The closest things I found that are about the MsgBox but they don't change it in the way I want are these:
B4X:
<item name="android:alertDialogTheme">@color/actionbar</item>
and this
B4X:
<item name="android:alertDialogStyle">@color/actionbar</item>

and as an example, when I change alertDialogStyle, the result will look like this:

It reminded me of ancient versions of android lol

So guys, Help me out
What exactly should I add in my manifest editor to override only the background color of the alertDialog?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Maybe this style can give you hints on how to do it:

B4X:
<style name="AlertDialogCustom" parent="@android:style/Theme.Material.Light.Dialog.NoActionBar">
      <item name="android:textColor">#039be5</item>        <!-- msgbox title text color -->
      <item name="android:background">#ffffffff</item>   <!-- msgbox background color -->
      <item name="android:textColorPrimary">#000000</item>    <!-- main msgbox text color -->
      <item name="android:colorAccent">@color/accentColor</item>  <!-- seekbar,, checkboxes,, switches,, + meterial dialogs etc. -->      
</style>
 
Upvote 0

mohdosala

Member
Thanks. It looked quite helpful. But unfortunately, didn't work. Tried it in two ways, first I added this style after the LightTheme style. App compiled without any problem but nothing was changed in msgBox design. Then I tried to add this new style in a new resource, and that led to compilation failure.
But that was very helpful for getting a better understanding about how manifest editor works.
I think I'm done putting any more efforts on this.
Finally I did my job using XUIViews. It's not as good as It could be if was able to edit the manifest but it did the job.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…