remove the color shown while selecting a widget
When we touch a widget say an image in android, a color will be shown surrounding it showing that image is pressed. How to rem开发者_JAVA技巧ove it?
According to the accepted answer of this question, seems that if you set a value (any color, or drawable) for the background, you'll not have that "shadow" effect anymore.
I had the opposite, so my problem sounds like the answer to your question.
I had a ListView where I set the background of each entry (an injected layout) to be White. Therefore, when I pressed, or used the TrackPad/Ball it never highlighted the entries.
Removing this Background colour and setting the background of the LinearLayout to White got mine working.
So setting the background of the Views you want to not show a colour around when touching/selecting should do the trick. Here is the xml for layouts:
android:background="#RRGGBB"
I had a similar probelm to what I think you are having, but I solved it by putting this:
android:cacheColorHint="#00000000"
My problem was with a list view, when I would scroll, the list view would turn black, this may be the problem you're having, I'm not sure.
Edit: Ahh yes, setting the background may solve the problem as well! You should check out transparent backgrounds, they could be useful for you, but beware, they can be a resource hog (from personal experience).
I used imageView.setBackgroundColor(Color.WHITE)
. It worked...Thanks for the help.
精彩评论