1

I would like to change the default orange color that appears when someone press an Android button. I have done many searches but all I found was the use of selectors. I understand the principle, but I don't want to modify the grey aspect of the normal button (not pressed). But using selectors force to define all characteristics of all aspects (pressed or not).

I don't know how to obtain the default aspect of buttons in the light theme, so can anyone tell me where I can find the original parameters of the light theme or at least give me another means to simply change the color of the button when clicked?

Herbert
  • 5,698
  • 2
  • 26
  • 34
sam
  • 3,441
  • 2
  • 33
  • 42

3 Answers3

1

You can copy the Android's selector into your project, the one that Android sets it by default to buttons, and modify only the state when the button is pressed by just changing one single drawable.

You could find the file in \android-sdk\platforms\android-10\data\res\drawable\btn_default.xml

Andy Res
  • 15,963
  • 5
  • 60
  • 96
  • really all my thanks !!! I a m really stupid, i should have wonder how the emulator of eclipse can display button without drawables. I will use the 9patch of a normal button. i was searching for 3 hours !! thanks – sam Sep 10 '12 at 15:21
0

Sorry bro........... i guess only selector will help you...... You must go with selector..... and selector are reusable xmls you can use in all buttons.....:) You can refer below link. :) http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

Amit Singh
  • 182
  • 8
  • 1
    if i could find the originals drawables it would not be a problem – sam Sep 10 '12 at 15:16
  • no problem, i discovered that i just have to put these in background with android:background, its just a special type of png, but thanks – sam Sep 10 '12 at 15:22
0

I tried to find a solution to this problem, but did not succeed. Maybe this will help: How to modify the default button state in Android without affecting the pressed and selected states?

Standard Android Button with a different color

Community
  • 1
  • 1
anber
  • 3,463
  • 6
  • 39
  • 68