Hi There,
I am new to Android programming and using Android studio for my development.
As you can see from the screenshot, I've got a "refresh icon" but it is more of a gray color and I want to make it white. Here is my style. There is no gray color used in the style and I don't know which item I should use to override its gray color.. Please help!
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="popupMenuStyle">#style/PopupMenu.Coin</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Coin</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Coin</item>
<item name="actionDropDownStyle">#style/DropDownNav.Coin</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Coin</item>
<item name="actionModeBackground">#drawable/cab_background_top_coin</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_coin</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Coin</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="ActionBar.Solid.Coin" parent="#android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="background">#drawable/ab_solid_coin</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_coin</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_coin</item>
<item name="progressBarStyle">#style/ProgressBar.Coin</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="ActionBar.Transparent.Coin" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="background">#drawable/ab_transparent_coin</item>
<item name="progressBarStyle">#style/ProgressBar.Coin</item>
<item name="android:windowContentOverlay">#null</item>
</style>
Consider using something like Android Asset Studio to create an icon with the desired opacity.
They already have a bunch of free to use (CCA 3.0) icons (including the same refresh icon you're using) and you can easily modify the opacity by modifying the opacity controller next to the 'Custom color' option.
Related
In my Android app, I am using a popup menu but its background is green.
I want it to be white.
The background is white if I run it on my Android 6.0 device, but shows up green on my Jellybean device.
I'm not using the Actionbar.
There are many posts about this issue and I've tried probably most of them but can't find the solution.
The closest I got was a white background but then the border disappears.
Or I get a white background but when pressing on an item, the selection shows a grey background except for the text's background which shows white.
I'm using AppCompat.
Here are some of the things I've tried:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="colorControlActivated">#d06655</item>
<item name="colorAccent">#ffe6e2</item>
<item name="android:colorActivatedHighlight">#ffe6e2</item>
<item name="android:windowBackground">#color/white</item>
<!--<item name="android:popupMenuStyle">#style/PopupMenu</item>-->
<!--<item name="android:itemBackground">#color/white</item>-->
<item name="popupMenuStyle">#style/myPopupMenuStyle</item>
<item name="android:popupMenuStyle">#style/myPopupMenuStyle</item>
</style>
<!--<style name="PopupMenu" parent="Widget.AppCompat.PopupMenu">-->
<!--<style name="PopupMenu" parent="#style/Widget.AppCompat.PopupMenu">-->
<style name="myPopupMenuStyle" parent="#style/Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">#android:color/white</item>
</style>
You can brash the popup menu by using Android Action Bar Style Generator(or create a 9patch background by your own).
So all I did was - specify proper colour in the generator, get 9patched background(menu_dropdown_panel_background.9.png) back and set it as a background:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="popupMenuStyle">#style/PopupMenu.Example</item>
</style>
<style name="PopupMenu.Example" parent="#style/Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_background</item>
</style>
That's it!
I building an application that uses ActionBarSherlock. I won't use ActionbarCompat so please focus on my question.
I made some code that can change the title color, as well as the subtitle color on the ActionBar. However when using my styles.xml for v21+ it will override those colors with the stock white colors (provided in Theme.Material)
Now I want to ask; what do I have to change in my code below to actually remove the Theme.Material colors override?
-EDIT
I noticed that it is working only when using a TextView in the Actionbar, however that's not what I want.
<style name="Theme.App.NoLight" parent="#android:style/Theme.Material">
<item name="android:colorAccent">#color/abs__holo_blue_light</item>
<item name="android:colorPrimary">#color/dark_holo</item>
<item name="android:logo">#android:color/transparent</item>
<item name="android:windowBackground">#color/dark_holo</item>
<item name="android:actionBarStyle">#style/Widget.Styled.ActionBar.NoLight</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="android:actionBarTabBarStyle">#style/ActionBarTabBarStyle</item>
<item name="android:actionBarTabTextStyle">#style/ActionBarTabTextStyle</item>
<item name="android:actionOverflowButtonStyle">#style/Widget.Sherlock.ActionButton.Overflow</item>
<item name="android:homeAsUpIndicator">#drawable/abs__ic_ab_back_holo_dark</item>
<item name="logo">#android:color/transparent</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="actionBarTabBarStyle">#style/ActionBarTabBarStyle</item>
<item name="actionBarTabTextStyle">#style/ActionBarTabTextStyle</item>
<item name="actionOverflowButtonStyle">#style/Widget.Sherlock.ActionButton.Overflow</item>
<item name="actionBarStyle">#style/Widget.Styled.ActionBar.NoLight</item>
<item name="homeAsUpIndicator">#drawable/abs__ic_ab_back_holo_dark</item>
</style>
I'm using HoloEverywhere and ActionbarSherlock to create my application. I've been successful in theming the listview i have in my main activity so that the color is grey instead of holo blue whenever pressed or focused. I would like to theme the preference options I have in a PreferenceActivity as well, but it only works for devices with pre-ICS. With devices running android 4.0+, whenever the option is pressed or focused, the color is still ICS blue.
Another question: I'm using a theme that's parent is Holo.Theme.Light.DarkActionBar. How would I make it so that it uses a light overflow popupmenu instead of the dark one? I've tried adding popupmenustyle to my styles, but I've had no luck
styles.xml:
<style name="Theme" parent="Holo.Theme.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background</item>
<item name="actionBarItemBackground">#drawable/selectable_background</item>
<item name="android:activatedBackgroundIndicator">#drawable/activated_background_holo_light</item>
<item name="activatedBackgroundIndicator">#drawable/activated_background_holo_light</item>
<item name="android:listChoiceBackgroundIndicator">#drawable/list_selector_holo_light</item>
<item name="android:actionBarStyle">#style/ActionBar</item>
<item name="actionBarStyle">#style/ActionBar</item>
</style>
<style name="ActionBar" parent="#style/Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="android:background">#666666</item>
<item name="android:icon">#drawable/icon</item>
<item name="background">#666666</item>
<item name="icon">#drawable/icon</item>
</style>
For me this works:
<item name="popupMenuStyle">#style/PopupMenu.Intellistats</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Intellistats</item>
where:
<style name="PopupMenu.Intellistats" parent="#style/Holo.ListPopupWindow">
<item name="android:popupBackground">#color/holo_orange_dark</item>
</style>
I am using ActionBarSherlock 4.0.2.
I need a fully transparent action bar (without the neon color bottom divider). Hence, I have the following style:
<style name="AppTheme" parent="#style/Theme.Sherlock">
<item name="windowActionBarOverlay">true</item>
<item name="icon">#drawable/ic_home</item>
<item name="titleTextStyle">#style/ActionBarCompatTitle</item>
<item name="android:windowFullscreen">true</item>
</style>
By using above code, I will still have the following effect.
In order to disable the background, I put the following code in SherlockFragmentActivity#onCreate. Then the problem gone.
getSupportActionBar().setBackgroundDrawable(null);
However, I would like to see the solution being implemented in styles.xml instead of Java code, as I have many other devices with different screen configuration. I modified the styles.xml to the following, without using the previously mentioned fix in the Java code.
<style name="AppTheme" parent="#style/Theme.Sherlock">
<item name="windowActionBarOverlay">true</item>
<item name="icon">#drawable/ic_home</item>
<item name="titleTextStyle">#style/ActionBarCompatTitle</item>
<item name="android:windowFullscreen">true</item>
<item name="android:background">#drawable/transparent</item>
<item name="background">#drawable/transparent</item>
</style>
However, the neon divider still visible. It seems that my fix using android:background and background does not work. Am I missing something?
<style name="AppTheme" parent="#style/Theme.Sherlock">
<item name="actionBarStyle">#style/AppTheme.ActionBar</item>
<item name="android:actionBarStyle">#style/AppTheme.ActionBar</item>
</style>
<style name="AppTheme.ActionBar" parent="#style/Widget.Sherlock.ActionBar">
<item name="background">#android:color/transparent</item>
<item name="android:background">#android:color/transparent</item>
</style>
I am currently making an app (Android 1.6) that can change between two different themes.
I made a custom theme that takes the Android light theme as a parent!
The trouble is that when I switch to white theme my text is not drawn but if I select something I can see the text. Furthermore when I switch themes my titleText, previous and next are the same as in my dark theme.
Here is the code I use for the theme:
<style name="Theme.White" parent="android:Theme.Light">
<item name="android:colorBackground">#color/text_color_dark</item>
<item name="android:textColor">#color/text_color_dark</item>
<item name="textPrev">#style/text_prev</item>
<item name="textRegular">#style/text_regular</item>
<item name="textTitle">#style/text_title</item>
<item name="textNext">#style/text_next</item>
<item name="pageBack">#style/page_back</item>
<item name="whiteBack">#style/white_back</item>
<item name="android:textColorPrimaryInverse">#android:color/primary_text_light</item>
</style>
</resources>
This is my style:
<style name="text_prev">
<item name="android:textColor">#color/text_color</item>
</style>
<style name="text_next">
<item name="android:textColor">#color/default_text_color_2</item>
</style>
<style name="text_regular">
<item name="android:textColor">#color/text_color_dark</item>
</style>
<style name="text_title">
<item name="android:textColor">#color/text_color_dark</item>
</style>
<style name="page_back">
<item name="android:background">#drawable/white_background</item>
</style>
<style name="white_back">
<item name="android:background">#drawable/white_container</item>
<item name="android:padding">10sp</item>
</style>
I use two more resources that are in my res/drawable folder. Everything works fine in the standard theme, but as soon as I switch to my light theme my text disappears.
Is there something that I'm doing wrong?
From your code snippet above you're setting both background and text to the same color i.e. "color/text_color_dark", these should be different.
<item name="android:colorBackground">#color/text_color_dark</item>
<item name="android:textColor">#color/text_color_dark</item>