Android ActionBar background (when app is collapsed/minimized) - android

Can't find how to set background color of ActionBar in collapsed state.
In fullscreen/opened state it works well but in collapsed/minimized it always the same gray color (color of android theme i derive from).
I want it to look like in youtube app.
Please help me.
Thank you beforehand.

Solution found.
Just set color to android:colorPrimary property.
<style name="AppTheme" parent="#style/Theme.AppCompat.Light">
<item name="android:textColorPrimary" tools:targetApi="21">#color/white</item>
<item name="android:colorPrimary" tools:targetApi="21">#color/green_back</item>
<item name="android:colorPrimaryDark" tools:targetApi="21">#color/green_back_dark</item>
...
</style>

Related

Android what is the resource name of the default window background color of the current scheme/style

I tried to find it, maybe it's too obvious :) but how is the resource named of the "default window background color" (that pale white in holo light for instance) to be used in xml design?
android:background="<help me out here>"
Of course, just not giving the background attribute at all will reset, I know that, but on some shapes we need this background color as fill color, so I need to know the resource name of it.
Thanks in advance!
Found it. It's #android:color/background_light respectively #android:color/background_dark depending on scheme.
try this
<style name="CustomMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#color/colorPrimary</item> //primary color of action bar
<item name="colorPrimaryDark">#color/colorPrimaryDark</item> //dark is the background color
<item name="android:textColorPrimary">#color/textColorPrimary</item>//text color
<item name="android:windowBackground">#color/windowBackground</item> //background color of the app
Hope it helps.Thanks Refer here i found a beautiful tutorial http://coderzpassion.com/android-working-with-material-design/

Android ActionBar Loading Issue

I've having an issue with my actionBar that I've implemented.The screenshots below that I've provided will highlight the problem that I'm facing.Currently when I start my MainActivity,I've a navigation drawer and an actionBar.But the problem I'm facing is that there a split-second loading of the actionbar where it's in its original white color as shown below.
And then it immediately proceeds on changing its color as I've set as shown belown.
My issue is,how do I prevent the ActionBar for being "white" for a quick split second before it changes color?How do I let the actionBar be immediately green the moment the Activity starts?Thank you for the help :)
If you target for minimum API level 11 , you can change ActionBar's background color by defining custom style, as:
<resources>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">ANY_HEX_COLOR_CODE</item>
</style>
And, set "MyTheme" as theme for application / activity. It will not show that split second problem.
Are you setting the color in your activity?
Perhaps you can try using Styles instead?

Customize touch feedback in Android ActionBar

I have my style defined as follows:
<style name="actionBarTheme" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/button_style</item>
<item name="android:titleTextStyle">#style/actionBarTitleText</item>
</style>
And the actionBar is actually of the color defined in button_style (correctly working in other parts of the code). The problem is that the items are not working correctly (the background color is too light).
Any idea on how to solve this? Thanks
EDIT:
In the picture there is the touch-feedback that I have now. The button_style has another touch effect (a darker one) since this is almost invisible.
You can have this affect with actionButtonStyle
<style name="appTheme">
<item name="android:actionBarStyle">#style/actionBarTheme</item>
<item name="android:actionButtonStyle">#style/actionButtonTheme</item>
</style>
and then place your button style as the background of that.
<style name="actionButtonTheme">
<item name="android:background">#drawable/button_style</item>
</style>
You will still need to set the background of your action bar but this only needs to be a colour or drawable image as that is all that will actually be used.

how to change background of overflow menuitem

I am trying to change the blue background of a focussed/pressed menuitem in the overflow menu.
I'm talking about this:
I think I've overwritten every possible attribute from the Themeand Theme.Holo in Themes.xml and went to each style in Styles.xml but couldn't change the blue background.
EDIT
i figured out that the style i should override is android:dropDownListViewStyle
but it didn't work at all.
but then i changed the theme from Theme.Holo.Light.DarkActionBar to Theme.Holo.Light and guess what? it worked!!
so, can anyone shed some light on this?? how can i change the color on a theme with DarkActionBar??
ok, i found a solution for my problem: link to a post in the ActionBarSherlock google group
i've overseen this entry: android:actionBarWidgetTheme in the Theme.Holo.Light.DarkActionBar theme.
now all i had to do is define a theme that overrides Theme.Holo with one style in it: <item name="android:dropDownListViewStyle">#style/myDropDownListView</item> and point to this theme instead.
<!-- theme referenced by actionBarWidgetTehme style -->
<style name="Theme.DropDown.Dark" parent="android:style/Theme.Holo">
<item name="android:dropDownListViewStyle">#style/myDropDownListView</item>
</style>
<!-- my main theme -->
<style name="DarkActionBarRedActionMode" parent="android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarWidgetTheme">#style/Theme.DropDown.Dark</item>
</style>
declare a selector drawable, and put it as background of listview item.
refer to drawable resource

Changing the action bar overflow icon to the dark version

In my application I am using my own theme based on the Theme.Holo.Light
However I have customised the actionBarStyle, setting the background drawable to a blue gradient to fit with my app's style.
However, with the Halo light theme, the action bar text is dark, & the default icons, such as the Up Nav arrow and the menu icon are dark, these don't go on my blue gradient.
As you can see from my XML below, I have managed to correct the title text colour but I can't find the attribute I need to override for the icons.
How can I change tell the theme to effectively use the icons on the ActionBar from Theme.Halo
instead of those Theme.Halo.Light but making the rest of my application remain using Theme.Halo.Light
Here's my current XML
<style name="MyLightTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="android:style/Widget.Holo.ActionBar">
<item name="android:background">#drawable/blue_gradient_light</item>
<item name="android:titleTextStyle">#style/Theme.ActionBar.TitleTextStyle</item>
</style>
<style name="Theme.ActionBar.TitleTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/solid_white</item>
</style>
Thanks for your help
Use Theme.Holo.Light.DarkActionBar as your base if you want to do this. It will take care of these details.

Categories

Resources