Android Question AppCompat not showing action bar in correct color

Misterbates

Active Member
Licensed User
Not sure what I've missed, but my action bar should be orange and instead it's black.

I thought I'd followed the AppCompat Material Design instructions!

I tried the Action Bar example (from Material Design 2) and that works fine, so I could use that as the starting point for my project ... but I'd rather know what it is I've missed so that next time I can fix it myself.

Project zipfile: https://drive.google.com/file/d/0B6LZPcxA3Ee4c2xxYTNFODhzbkE/view?usp=sharing

Can anyone spot an error?
 

Attachments

  • Screenshot_20170529-194802.png
    Screenshot_20170529-194802.png
    42.7 KB · Views: 215

Misterbates

Active Member
Licensed User
Erel, thanks very much for taking a look.

1. You should use File - Export as zip to create the zip file. It would have created a much smaller zip file.
Noted - apologies, newbie error.

2. The resources and the custom build action are no longer needed.
Noted - the project came from a larger project where the resources are used but you're right, I didn't need to share them all in the zipfile.

3. The style parent should be set to: Theme.AppCompat.Light.NoActionBar
I entered the below in the Manifest Editor but no change to the dark action bar. So I started from your example project and re-added my code step by step - the problem hasn't re-occurred.

B4X:
'Set custom theme

SetApplicationAttribute(android:theme, "@style/MyAppTheme")

'Create Resource for the theme (Material, v21 and up)
CreateResource(values, themes.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#FF9800</item>
        <item name="colorPrimaryDark">#F57C00</item>
        <item name="colorAccent">#FFA726</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="windowActionModeOverlay">true</item>
    </style>
</resources>
)

I'm still curious why this was happening, but for right now have more important things to do.

Thanks for your help. Always nice to get an answer to a post :)
 
Upvote 0
Top