Questions tagged [android-selector]

238 questions
267
votes
5 answers

Android customized button; changing text color

I made a button that changes the background drawable on different states, this way:
dwbrito
  • 5,194
  • 5
  • 32
  • 48
215
votes
9 answers

Android selector & text color

I want a simple TextView to behave the way simple_list_item_1 in a ListView does. Here's the XML:
yanchenko
  • 56,576
  • 33
  • 147
  • 165
55
votes
4 answers

Android - Remove Spinner Dropdown Arrow

I'm just wondering if it's at all possible to simply remove the dropdown arrow for a spinner? I have a drawable arrow in a backgroud layout for my spinner, however the system default arrow appears to the right of the spinner, which I would like to…
47
votes
3 answers

Shaped drawable with selectableItemBackground as background

I have couple buttons that I need an oval shaped border. So i have this in a capsule_border.xml
42
votes
6 answers

How to use selector to tint ImageView?

I want to tint my tabhost's icons using XML, instead of doing it programmatically (I wasn't able to do that anyway)... I found this thread on SO: Android imageview change tint to simulate button click That seems to be a pretty good solution, but I…
Lucas Jota
  • 1,863
  • 4
  • 24
  • 43
37
votes
14 answers

How set ListView not clickable

I have this ListView that just needs to show data. So I don't want to make it clickable. First I've tried changing XML listview to:
Tizianoreica
  • 2,142
  • 3
  • 28
  • 43
36
votes
2 answers

Android: How to Make A Drawable Selector

I feel like this is kind of a silly question, but here I go anyways. I have an image button, and I want to be able to change it's image everytime it is clicked. The API seems to say that the best way to go about doing this is to create xml…
aamiri
  • 2,420
  • 4
  • 38
  • 58
23
votes
2 answers

Android: can you have a ripple effect whose default state color is transparent?

Something like the following, but it doesn't work. If I switch the drawable color to something like blue, it works.
ZakTaccardi
  • 12,212
  • 15
  • 59
  • 107
22
votes
3 answers

How to define bold in an Android selector?

In my Android app I've got a couple radion buttons which should get a different color and become bold upon selection. I managed to get the different color by defining a radio_pick_color.xml file in drawable:
kramer65
  • 50,427
  • 120
  • 308
  • 488
21
votes
5 answers

android selectableItemBackground selection

i want to change background of my view when the state is "activated" and i want to preserve the effects(ripple) of ?attr:selectableItemBackground. Is it possible to extend or combine selector of ?attr:selectableItemBackground?
Asiat
  • 401
  • 1
  • 5
  • 14
21
votes
3 answers

Android how to make button text bold when pressed or focussed

I want to change the text inside a button to be bold when the button is highlighted or pressed. I currently use a xml file to define the button and use the XML to change how it looks when pressed but I would like to do this without using an…
stealthcopter
  • 13,964
  • 13
  • 65
  • 83
19
votes
3 answers

Android - State Selector Animations - Only animate de-press, NOT press

I have a very basic selector that I am using as the background for some buttons to achieve down states. Here's the xml:
19
votes
8 answers

Deselect selected item in ListView

I use a ListView in my layout like this:
Ron
  • 22,128
  • 31
  • 108
  • 206
18
votes
2 answers

Disable button with button selector

I have a button selector that changes the button image when it is pressed. I have also set an image for when the button is disabled. I try and disable the button programmatically but the disabled button image is not appearing. Is my button_selector…
DMC
  • 1,184
  • 5
  • 21
  • 50
14
votes
5 answers

GridView item list selector for multiple items not working in Android

I want to draw selector on long press as shown in the picture. When I do long press on one item, the CAB menu is activated. But the list selector indicator goes off once after clicking. I want that list selectors to be active till the CAB menu is…
1
2 3
15 16