Android Question Why I can't change action bar text to White?

Dianzoa

Active Member
Licensed User
I post my manifest, Thank You.

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:networkSecurityConfig, @xml/network_security_config)
SetApplicationAttribute(android:theme, "@android:style/Theme.Material.Light")
'SetApplicationAttribute(android:theme, "@style/MyAppTheme")
CreateResource(xml, network_security_config.xml,
<network-security-config>
<base-config cleartextTrafficPermitted="true">
    <trust-anchors>
        <certificates src="system" />
    </trust-anchors>
</base-config>
</network-security-config>

)

'SetApplicationAttribute(android:theme, "@style/MyAppTheme")
'
'CreateResource(values, theme.xml,
'<resources>
'    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
'        <item name="colorPrimary">#ff039be5</item>
'        <item name="colorPrimaryDark">#ff039be5</item>
'        <item name="colorAccent">#AAAA00</item>
'        <item name="windowNoTitle">true</item>
'        <item name="windowActionBar">true</item>
'    </style>
'</resources>
')


CreateResource(values, dimen.xml,
<resources>
<dimen name="action_button_padding">10dp</dimen>
</resources>
)
CreateResource(values, colors.xml,
<resources>
    <color name="actionbar">#ff039be5</color>
    <color name="statusbar">#ff006db3</color>
    <color name="textColorPrimary">#ffffff</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:actionButtonStyle">@style/ActionButton</item>
    </style>
    <style name="ActionButton" parent="@android:style/Widget.ActionButton">
       <item name="android:drawablePadding">@dimen/action_button_padding</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>
        <item name="android:actionButtonStyle">@style/ActionButton</item>
    </style>
    <style name="CustomActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@color/actionbar</item>
        <item name="android:actionButtonStyle">@style/ActionButton</item>
    </style>
    <style name="ActionButton" parent="@android:style/Widget.ActionButton">
       <item name="android:drawablePadding">@dimen/action_button_padding</item>
       <item name="android:actionButtonStyle">@style/ActionButton</item>
   </style>
</resources>
)
AddPermission(android.permission.FOREGROUND_SERVICE)
'End of default text.
 

Dianzoa

Active Member
Licensed User
upload_2019-6-24_20-28-35.png
 
Upvote 0

Brandsum

Well-Known Member
Licensed User
You havn't set LightTheme to your application.
Change this
B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Material.Light")
To this
B4X:
SetApplicationAttribute(android:theme, "@style/LightTheme")
 
Last edited:
Upvote 0

Dianzoa

Active Member
Licensed User
You havn't set LightTheme to your application.
Change this
B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Material.Light")
To this
B4X:
SetApplicationAttribute(android:theme, "@style/LightTheme")
Thank You! That works.
 
Upvote 0

Dianzoa

Active Member
Licensed User
I need a little more help, How can I change the phone bar to the same color as my action bar? Also, the menu items is not readable because it's white.
upload_2019-6-25_15-30-16.png
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
you should create new thread for different question. this thread has already been solved so making this a long thread will not help other members
 
Upvote 0

Dianzoa

Active Member
Licensed User
you should create new thread for different question. this thread has already been solved so making this a long thread will not help other members
Ok ok. But I think is related to the original question, since the lighttheme by default makes the bar skyblue or something
 
Upvote 0

Dianzoa

Active Member
Licensed User
Anyway, this did it
B4X:
<color name="textColor">#000000</color>
then

<item name="android:textColor">@color/textColor</item>
 
Upvote 0
Top