1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

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

Discussion in 'Android Questions' started by Dianzoa, Jun 25, 2019.

Similar threads

B4A Code Snippet Theme Colors
B4A Code Snippet Full Screen Theme
Other B4A v5.80 BETA is released!
B4A Code Snippet Version safe themes
B4A Tutorial Integrating Firebase Services
B4A Tutorial TabStripViewPager - Better ViewPager
  1. Dianzoa

    Dianzoa Active Member Licensed User

    I post my manifest, Thank You.

    Code:
    '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.
     
  2. Dianzoa

    Dianzoa Active Member Licensed User

  3. Brandsum

    Brandsum Active Member Licensed User

    You havn't set LightTheme to your application.
    Change this
    Code:
    SetApplicationAttribute(android:theme, "@android:style/Theme.Material.Light")
    To this
    Code:
    SetApplicationAttribute(android:theme, "@style/LightTheme")
     
    Last edited: Jun 25, 2019
    Dianzoa and DonManfred like this.
  4. Erel

    Erel Administrator Staff Member Licensed User

    This is not the correct way to set a light theme.

    Correct manifest code:
    Code:
    CreateResourceFromFile(Macro, Themes.LightTheme)
     
  5. Brandsum

    Brandsum Active Member Licensed User

    The name of his custom theme is LightTheme.
     
    Erel likes this.
  6. Erel

    Erel Administrator Staff Member Licensed User

    You are correct!!!
     
  7. Dianzoa

    Dianzoa Active Member Licensed User

    Thank You! That works.
     
  8. Dianzoa

    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
     
  9. Dianzoa

    Dianzoa Active Member Licensed User

  10. ronell

    ronell Well-Known 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
     
  11. Dianzoa

    Dianzoa Active Member Licensed User

    Ok ok. But I think is related to the original question, since the lighttheme by default makes the bar skyblue or something
     
  12. Dianzoa

    Dianzoa Active Member Licensed User

    Anyway, this did it
    Code:
    <color name="textColor">#000000</color>
    then

    <item name=
    "android:textColor">@color/textColor</item>
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice