Text color inverting on selection - android

I have a multichoice ListView whose items have a light (transparent) background by default and a dark one while selected. Therefore, I would like to have the TextViews in the items change their color accordingly, i.e. black by default and white while selected.
Obviously, I can manually define a selector that does this, but is there some predefined color or style in the Android SDK that I could use out of the box?
Just for illustration, the navigation drawer in Gmail does this:

Related

Set color of ShareActionProvider

I defined a color for my whole app (a dark grey) and so when I click on the ShareActionProvider, a black list shows up but the text color is dark grey too (and so not really visible). The text in the ActionBar is white, but not the one in the list.
Is there any way I can set a different color (some item in styles.xml ?)
Thanks
Best way to customize shareActionProvider is create separate menu specifically for Sharing. See this link https://stackoverflow.com/a/22192759/1237175

Override list item background color with white, keep system default (long)pressed color

How can I replace the color of a listview item background when in the non-(focused|pressed|activated) state with a custom color, but keep all the system default colors for pressed, long-pressed, activated, focused etc. states?
I'm trying to give my listviews a card style - that is white items with space in between on a grey background (as in Google Play Store app and others).
So I want to give the items a white background, but at the same time, keep all the system default selectors, including the fade animation for long press. That is, I want to replace the transparent color for the inactive states with white, but keep all the other states as by default.
This is even more important since the KitKat release, because all the accents have now switched from blue to grey, so I would like the app to respect that - to have blue color when pressed on ICS and JellyBean, but grey on KitKat. Therefore, I don't want to hard-code any values into a custom selector.
All right, I figured it out and it's incredibly simple:
All I have to do is to add this attribute to the given ListView:
android:drawSelectorOnTop="true"
And that's all! I can give the list items any background color that I want and it will always be overlayed by the system default selector!

how can I customize and change the background color of spinner in android?

I want to change the background color of spinner and customize spinner. When I used this code in xml android:background="#000000" the color changed but the arrow on the spinner disappears. How can I cuztomize spinner and change the background color without disappearing the arrow?
The arrow is black (or close to it) by default, so it won't show up on a black background. You can change the arrow with the android:dropDownSelector attribute in your XML.
The "background" attribute on a spinner refers to a drawable which contains the background color and the arrow. By specifying a color for the background, there is no longer any arrow. To fix this you need to provide a new 9 patch drawable with the arrow in it.

Android: use dark ExpandableListView icon?

My app uses Theme.Holo. When I instantiate an ExpandableListView, it uses white icons for the group rows. (in the image, the icon is visible in the first row because I am pressing this row to highlight it, the other rows have invisibly white icons).
I know I can set the group icon with ExpandableListView.setGroupIndicator(), but I would rather specify to use a dark version of the OS icon, if this is possible?
You will need to change the default group indicator in this case. A light or dark indicator are just different icons anyway. Without changing the theme, the only way is to change the icons/drawables for the indicator.

Spinner selection issue

I want to implement the below:
A spinner which would have a custom layout, its background color would be black and font would be white. But what I want is that when I select any component then my selection background and font color should reverted back to its defaults (in terms of color).
#Rao use custom Spinner and for colour state change use Color State list

Categories

Resources