Home Icon Up Indicator Compat Action Bar - android

I'm trying to change the "up" indicator, I've implemented the new compat action bar and I'm not able to customize it.
I've tried adding to values-v11/styles.xml
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="android:icon">#drawable/ic_action_logo_barra_de_acciones_blanco</item>
<item name="android:background">#drawable/action_bar_style</item>
<item name="android:homeAsUpIndicator">#drawable/arrow_up_black</item>
</style>
and to values/styles.xml
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="background">#drawable/action_bar_style</item>
<item name="icon">#drawable/ic_action_logo_barra_de_acciones_blanco</item>
<item name="homeAsUpIndicator">#drawable/arrow_up_black</item>
</style>
But is still not working.
Thanks in advance, Diego.

Sorry, maybe already late, but I had same issue and solved it by defining "homeAsUpIndicator" in main theme before ActionBar style.
Here is my res/values/styles.xml
<style name="AppBaseTheme" parent="#style/Theme.AppCompat.Light">
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="homeAsUpIndicator">#drawable/abc_ic_ab_back_holo_dark</item>
<item name="actionBarStyle">#style/Widget.Styled.ActionBar</item>
</style>
<style name="Widget.Styled.ActionBar" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="background">#drawable/messages_form_banner</item>
</style>
I hope it will help you.

Related

Support Actionbar Icon overlay ActionbarDivider

i try to fix a bug in my app.
In case of that i have to change my ActionBar to the SupportActionbar!
But now my icon overlays the divider.
And the TitleText is away can u help me?
Thank you!
Styles:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- API 11 theme customizations can go here. -->
<item name="android:actionBarStyle">#style/myActionBar</item>
<item name="android:background">#000000</item>
</style>
<style name="myActionBar" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:background">#drawable/abc_ab_transparent_dark_holo</item>
<item name="android:textColor">#FFFFFF</item>
<item name="actionBarItemBackground">#android:color/transparent</item>
</style>

Android ActionBar Background gets overridden by AppTheme Background

I just can't figure this one out:
I have an application with an ActionBar, I want the ActionBar to be red and the background of the app blue. I tried to achieve this with this styles.xml:
<style name="AppTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:background">#color/blue</item>
<item name="background">#color/blue</item>
<item name="android:layout_marginTop">5dp</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/red</item>
<item name="background">#color/red</item>
</style>
But the actionBar is always blue. When I take away the blue background of the app, the actionBar is red as desired...
Any ideas?
The margin that you set is ambiguous and does not apply to anything. You should set the margin on your action bar theme:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/red</item>
<item name="android:windowBackground">#color/blue</item>
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:layout_marginTop">5dp</item>
</style>
If all you're trying to do is a red action bar with a blue background, it is much easier to use the material properties included with v21+ of the support library:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/red</item>
<item name="android:windowBackground">#color/blue</item>
</style>

Android's Material Design of Toolbar / SupportActionBar

I'm experimenting with the news themes tonight and I'm wondering if anyone knows these fix to this issue.
This appears on the stock Toolbar and even, as seen below, when referring to custom layout file.
It's relatively minor but my OCD eyes go right to it so maybe someone can help. Thanks :)
UPDATE: Inheriting from the correct theme and declaring attributes in pairs (with and without the android: prefix) was the fix!
<!-- Base app theme. -->
<style name="AppTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<!-- ActionBar styles. -->
<style name="MyActionBar" parent="Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
<item name="titleTextStyle">#style/MyActionBarTitleText</item>
<item name="android:subtitleTextStyle">#style/MyActionBarSubTitleText</item>
<item name="subtitleTextStyle">#style/MyActionBarSubTitleText</item>
<item name="android:background">#color/blue</item>
<item name="background">#color/blue</item>
</style>
<style name="MyActionBarTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
<style name="MyActionBarSubTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle">
<item name="android:textColor">#color/white</item>
<item name="android:textSize">#dimen/subtitle</item>
</style>
If es0329's answer doesn't work for you, try to replace titleTextStyle by titleTextAppearance. It is working for me:
<style name="MyActionBar" parent="Widget.AppCompat.ActionBar">
<item name="android:titleTextAppearance">#style/MyActionBarTitleText</item>
<item name="titleTextAppearance">#style/MyActionBarTitleText</item>
<item name="android:subtitleTextAppearance">#style/MyActionBarSubTitleText</item>
<item name="subtitleTextAppearance">#style/MyActionBarSubTitleText</item>
<item name="android:background">#color/blue</item>
<item name="background">#color/blue</item>
</style>

Fully Transparent Action bar on Holo Light Theme

I want to make full translucent action bar like google did, i tried several option, that seems to work on Holo, however they are not "full transparent" in Holo.Light
this is my style so far:
<style name="MyTheme.Translucent" >
<item name="windowActionBarOverlay">true</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="actionBarStyle">#style/MyTheme.ActionBar</item>
<item name="android:actionBarStyle">#style/MyTheme.ActionBar</item>
</style>
<style name="MyTheme.ActionBar" parent="#style/Widget.Sherlock.ActionBar">
<item name="background">#android:color/transparent</item>
<item name="android:background">#android:color/transparent</item>
</style>
and in Oncreate:
getSupportActionBar().setBackgroundDrawable(null);
the result its "almost" what i need
however i see a shade in action bar:
What i want (or something like this)
i found the solution
using
<item name="android:windowContentOverlay">#null</item>
will do the trick to remove the line
please check the link....................
http://cyrilmottier.com/2013/05/24/pushing-the-actionbar-to-the-next-level
**values/themes.xml**
<style name="Theme.TranslucentActionBar" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/Widget.ActionBar</item>
</style>
<style name="Theme.TranslucentActionBar.ActionBar" />
<style name="Theme.TranslucentActionBar.ActionBar.Overlay">
<item name="android:actionBarStyle">#style/Widget.ActionBar.Transparent</item>
<item name="android:windowActionBarOverlay">true</item>
</style>
**values/styles.xml**
<style name="Widget.ActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/ab_background</item>
</style>
<style name="Widget.ActionBar.Transparent">
<item name="android:background">#android:color/transparent</item>
</style>

Android: action overflow icon blue underline

I'm trying to remove the blue underline in the action bar overflow icon. Here is the screenshot:
I don't have tabs but I saw some similar answered questions about action bar tabs underline but nothing worked for me. My Base application theme is Theme.AppCompat.Light. Here are the applied styles:
<style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:activatedBackgroundIndicator">#drawable/nav_drawer_selection</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:windowActionBar">true</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionMenuTextColor">#color/white</item>
<item name="android:actionOverflowButtonStyle">#style/OverFlow</item>
<item name="actionBarStyle">#style/MyActionBar</item>
<item name="actionMenuTextColor">#color/white</item>
<item name="actionOverflowButtonStyle">#style/OverFlow</item>
<item name="android:activatedBackgroundIndicator">#drawable/nav_drawer_selection</item>
</style>
<style name="MyActionBar"
parent="#style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
<item name="android:background">#color/red</item>
<item name="titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<style name="MyActionBarTitleText"
parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
<style name="OverFlow"
parent="#style/Widget.AppCompat.ActionBar">
<item name="android:src">#drawable/ic_launcher</item>
</style>
Thanks for all the help! If you need more info about the app and code let me know :)
#nejc.m i think it's due to inheritance from the "Widget" parent. Try replacing "Widget.AppCompat.ActionBar" with "Theme.AppCompat.Light.DarkActionBar". Let me know if this works.
I played around and I found out that it's a very easy solution. I added <item name="android:background">#color/red</item> to <style name="OverFlow" parent="#style/Widget.AppCompat.ActionBar">

Categories

Resources