In 4.x devices, the drawable which indicates that this is a spinner and should be clicked is barely visible; it is using spinner_ab_default_holo_light.9.png. How can I make it use spinner_ab_default_holo_dark.9.png, or any other drawable of my choice?
The spinner is in a dialog. The app uses ActionbarSherlock 4.3.1 for Android 2.2.3 upwards compatibility. The app implements Android Action Bar Style Generator to create a Sherlock.Light.DarkActionBar theme. I am using a Values and a Values-v14 to manage the styles. This dialog attaches a specific style:
new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.FibroDialog))
which, in Values-v14, has a parent theme to make sure the dialog background is dark:
<style name="FibroDialog" parent="#android:style/Theme.Holo.Dialog">
</style>
Things I have tried:
In the theme generated by Android Action Bar Style Generator I added
<item name="android:spinnerItemStyle">#style/MySpinnerItemStyle</item>
and then added
<style name="MySpinnerItemStyle" parent="android:TextAppearance.Holo.Widget.TextView.SpinnerItem">
<item name="android:textColor">#FFF</item>
<item name="android:background">#drawable/spinner_background_ab_fibromapp</item>
</style>
which resulted in the drawable I actually want becoming the background of the item, not the spinner.
In the xml for the spinner, I tried
android:dropDownSelector="#drawable/spinner_ab_default_fibromapp"
which gives the same result as above, and
android:popupBackground="#drawable/spinner_ab_default_fibromapp"
which replaces the background of each spinner item with the drawable.
As a last resort, I made my own spinner_ab_default_holo_dark and spinner_ab_default_holo_light 9-patches; and they didn't show up at all.
How can I access that spinner drawable and change it to whatever graphic I want?
Although i'm new at this, i've also spent far too many hours looking for a similar answer. It seems the only solution is to create a style which is an exact copy of the system's spinner style and edit that which you which to change. It's troublesome, boring and not really practical, but if it must be done, it must be done... Due to time constraints, I ended up changing my layout a bit so that the standard spinner wouldn't look too bad.
Related
I want to change the background and text colors of the pop up menu that appears when the user presses the overflow icon.
If I use Theme.Holo or Theme.Holo.Light it works, but I'm using Theme.Holo.Light.DarkActionBar and it never works. I'm starting to assume that it's an Android bug.
I'm testing on a Nexus 4 with 4.4.2 but it also doesn't work on an emulator with API 19.
After trying a lot of potential solutions that I came across here in StackOverflow, here is what I'm doing:
<style name="Theme.MyApp" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarWidgetTheme">#style/ActionBarWidget</item>
</style>
<style name="AndroidPitActionBarWidget" parent="android:Theme.Holo.Light">
<item name="android:popupMenuStyle">#android:style/Widget.Holo.Light.PopupMenu</item>
<item name="android:dropDownListViewStyle">#android:style/Widget.Holo.Light.ListView.DropDown</item>
</style>
That works but it changes the styling of the SearchView, which is another pain to change.
So I'm not considering this a solution.
What I want is to just change the background/text of the popup to the Light version, which is light background with black text.
I also tried setting those two attributes in the main theme instead of using the actionBarWidgetTheme.
It's really frustrating to waste hours on this kind of problems.
I also tried using Action Bar Style Generator to make the background white, but then the text is white and I can't change it to black.
Thanks very much in advance.
If you set the background color of that panel using the theme you get in the Action Bar Style Generator, you can try adding the android:textColor attribute of the drop down ListView.
If that does not work, you can alternately set the string color in code during your onCreateOptionsMenu method as detailed on this SO thread
So I've basically looked into every resource I saw online on how to change the blue underline in the tabs, but all of the advice has not worked in my case.
I tried actionbarsherlock, appcombat, holo from Action Bar Generator but all the coloring did was color the top action bar, not the tab underline. And yes the files did compile and did not have any errors, but for some reason, it seemed like the underline would never be changed even through the generator.
I am confused on how to change the default blue underline on the tabs, and I would SO EXTREMELY appreciate it if there was a working custom style xml that you would share.
After going to Changing ActionBar tabs underline color programmatically result is still same :/
Screen shot after trying from other page: http://i.stack.imgur.com/EOUbu.png
Anyone able to help me out?
I've been struggling with this for days, but finally found the solution. I'm using AppCompat. You can set colorAccent in your theme and that will change the highlight color on your ActionBar. Like so:
<item name="colorAccent">#color/highlightcolor</item>
Here it is in context:
<style name="LightTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/darkgrey</item>
<item name="colorPrimaryDark">#color/black</item>
<item name="colorAccent">#color/highlightcolor</item>
</style>
You need to define a custom theme for that, and then check the states to change the colour of the line. See if this answer helps you
Not sure if you are still pursuing this, but can you show what you did with Action Bar Generator? What Style entries did you add (in XML) and which drawables did you add?
I just went through the same process and it worked well with Action Bar Generator; just required a few lines added to the styles.xml, a new xml file in drawables folder, and then about 5 new image drawables into each of the resolution size folders (drawable-hdpi, etc).
In my current implementation, I have modified the whole style of my application...
I successfully modified the Spinner style, so I was able to change the RadioButton look and feel:
I am now working on the title, but seems really hard to style.
I would like to change, for instance the title text color (and optionally removing the triangle)
I know I could do that by extending Spinner or Dialog, but I have to do achieve that by playing with xml.
Here is my current code that succesfully modified other dialog properties:
<style name="Theme.HoloEverywhereDark.Sherlock" parent="Theme.Sherlock">
<item name="android:spinnerStyle">#style/SpinnerDark</item>
<item name="android:spinnerItemStyle">#style/SpinnerItemDark</item>
<item name="android:spinnerDropDownItemStyle">#style/DropDownItemDark</item>
</style>
To change the triangle, you could use the second answer here: How to create android spinner without down triangle on the right side of the widget
I haven't yet figured out how to style the main text, but you may just be able to apply normal text field formatting to it via the Spinner in xml (textColor, etc).
I'm trying to make a custom titlebar for my first Android application.
While I can find lots on the web about how to make them so you can change colours etc, I want my titlebar to look the same as the "standard" titlebar, but with a button that I can configure. This means copying the device's currently active themes to be able to style it in exactly the same way.
Not all devices simply use a gradient in the titlebar style, so adding a gradient (as suggested in other SO questions) doesn't really make sense.
Does anyone have any pointers how to read the style information?
try to extend an existing theme e.g.
create your own style which can ofcourse extend from existing from an existing theme. change the windowNoTitle to true.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="noTitleBarStyle" parent="android:Theme.Black">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">#color/darkGrey</item>
<item name="android:colorForeground">#ff3333</item>
</style></resources>
or try to do it runtime as discussed here
Android - change custom title view at run time
I hope this helps.
tl;dr: White text style in app theme being picked up by search dialog, making search text invisible.
I'm struggling mightily with what seems like a trivial issue.
My app is using a dark background, and I've tweaked the text color to be brighter than the standard gray using #EEEEEE.
I've implemented a Search Dialog (pre-Honeycomb) and it works well, but the text in the search dialog picks up the same #EEEEEE so it is essentially invisible. Even the context menu displayed when I long press the search text picks up #EEEEEE, so the text there is invisible as well.
I'm tearing my hair out, and I'm running out of hair.
Style:
<style name="master" paret="#android:style/Theme.NoTitleBar">
<item name="android:textColor">#EEEEEE</item>
<item name="android:windowNoTitle">true</item>
</style>
Manifest:
<application android:icon="#drawable/icon"
android:label="#string/app_label"
android:theme="#style/master"
android:hardwareAccelerated="true"
android:debuggable="true">
The attribute android:textColor is not meant to be used inside theme styles, it is primarily useful in widget and text appearance styles.
If you want to change the general text colors through a theme, use instead the android:textColor* family of attributes. There are quite a few of them, and different Views use them differently, so it takes a bit of experimentation (or careful studying of the Android source code) to to get it all right. The android.R.attr documentation lists them all. Look for the attributes that begin with textColor....
To get you started, try this theme, it will behave better by not affecting the Search Dialog colors at all, which seems to be what you want. By the way, you don't need to set android:windowNoTitle to true in your theme as your parent theme does that already:
<style name="master" parent="#android:style/Theme.NoTitleBar">
<item name="android:textColorPrimary">#EEEEEE</item>
<item name="android:textColorSecondary">#EEEEEE</item>
<item name="android:textColorTertiary">#EEEEEE</item>
</style>
I got into the same problem as you. I've looked around for a solution but it seems that you just can't change the textColor of a dialog. My solution was creating a custom dialog based on this tutorial: http://blog.androgames.net/10/custom-android-dialog/
I extended this a lot based on the Android source code, always using the same method names etc to make it a bit easier.
It is not ideal, but as far as I know it's the best option...
EDIT: for your problem there might be a simpler solution: don't put the textColor into the theme, but put it in a style. I don't know how you're styling your app but I'm usually creating a "master-style" which all the others inherit from (direct or indirect). You could then put the textColor in there so all your standard dialogs will still have the standard textColor.