I'm trying to customize a bit my Action Bar, but by doing this, the title in the Action Bar vanish, while the background color correctly change.
Does anyone know where's the problem?
Thank you in advance.
Here is my .xml file:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="AppBaseTheme">
<item name="android:background">#color/ActionBarColor</item>
</style>
</resources>
Your action bar theme should have a parent of #style/Widget.AppCompat.Light.ActionBar, rather than AppBaseTheme.
Related
I have an activity which displays a fullscreen bitmap image. When the user clicks on the image, the action bar will be hidden. Currently, the bitmap will resize once the action bar is hidden. To address this issue, I have tried overlaying the action bar, as described in the developer guides.
<resources>
<style name="AppTheme" parent="#android:style/Theme.Holo">
<item name="android:homeAsUpIndicator">#drawable/ic_ab_back_holo_dark_am</item>
<item name="android:actionBarStyle">#style/NormalActionBarTheme</item>
</style>
<style name="NormalActionBarTheme" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:windowActionBarOverlay">true</item>
<item name="android:background">#color/my_green</item>
</style>
</resources>
This displays my solid green action bar, but the windowActionBarOverlay call doesn't seem to do anything- the bitmap will still resize when I hide the action bar.
My minimum sdk is currently set to 16/Jelly Bean/4.1.x, and I am running Lollipop.
What did I do wrong? I appreciate any advice. Thanks!
Set the overlaying option directly to your app's style theme.
<style name="AppTheme" parent="#android:style/Theme.Holo">
<item name="android:homeAsUpIndicator">#drawable/ic_ab_back_holo_dark_am</item>
<item name="android:actionBarStyle">#style/NormalActionBarTheme</item>
<item name="android:windowActionBarOverlay">true</item>
</style>
I am using custom title bar and its shows content as Theme.light. I tried to change it Theme.Holo but it doesn't work. can anyone help me?
<resources>
<style name="CustomWindowTitleBackground" >
<item name="android:background">#DDDDDD</item>
</style>
<style name="CustomTheme" parent="android:Theme.Holo">
<item name="android:windowTitleSize">73dip</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowTitleBackgroundStyle">#style/CustomWindowTitleBackground</item>
</style>
Provide some more details. Are you using the support action bar? When using the app compat action bar (from the support library) you can only use Theme.AppCompat / Theme.AppCompat.Light and related ones for your activity.
I'm trying to tweak my app with some custom colors but I cannot change the text color of the action bar.
This is how it is currently showing:
If you look close you might see letters in the white tab bar. I'm trying to change this color to black without changing anything else of the action bar.
This is how my styles.xml looks like:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/ActionBar</item>
</style>
<style name="ActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/default_green</item>
<item name="android:backgroundStacked">#color/stacked_white</item>
<item name="android:backgroundSplit">#color/sa_green</item>
</style>
Any help is appreciated.
You can make your custom theme here:
http://jgilfelt.github.io/android-actionbarstylegenerator/
Which includes all tabs and other component.
Try this ...
This should be in the theme
<item name="actionBarTabTextStyle">#style/tabtextcolor</item>
<item name="android:actionBarTabTextStyle">#style/tabtextcolor</item>
This should be where you define the tab text color.
<style name="tabtextcolor" parent="#style/Widget.Sherlock.ActionBar.TabText">
<item name="android:textColor">#android:color/white</item>
</style>
I am trying to change the background of the action bar via xml, but the action bar is not shown anymore at all.
This is the style that I am using, declared in styles.xml:
<style name="AppBaseTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarStyle">#style/DiaryActionBar</item>
<item name="android:actionBarStyle">#style/DiaryActionBar</item>
</style>
<style name="DiaryActionBar"
parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="background">#color/action_bar_bg</item>
<item name="android:background">#color/action_bar_bg</item>
</style>
I have set both android:background and background for compatibility. This is the only styles.xml file in my app. What am I doing wrong?
In my style with custom actionbar background, i have this:
<style name="Theme.Malaka" parent="#style/Theme.AppCompat">
<style name="Malaka.ActionBar" parent="#style/Widget.AppCompat.ActionBar">
And that works just fine. Items of the styles are the same as yours. Please note that the parent of Malaka.ActionBar is not Theme... but Widget...
For changing background and actionBarStyle from android styling.You can do like this..
<style name="AppBaseTheme" parent="#android:style/Theme.Black">
<item name="android:actionBarStyle">#style/Theme.DeviceDefault.NoActionBar</item>
</style>
<style name="DiaryActionBar" parent="#android:style/Theme.Black">
<item name="android:background">#color/action_bar_bg</item>
</style>
I applied a gradient background to my ActionBar. I can see it in the preview on Eclipse but when I run the app on my phone, the action bar vanishes completely. Why is this happening?
styles.xml
<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">#style/AppTheme.ActionBarStyle</item>
</style>
<style name="AppTheme.ActionBarStyle" parent="android:Theme.Holo.Light">
<item name="android:background">#drawable/bg_actionbar</item>
</style>
</resources>
try use to:
Drawable d=getResources().getDrawable(R.drawable.background_image_name);
getActionBar().setBackgroundDrawable(d);
and see this question link