Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a Button's background back to default (programmatically)?

Tags:

android

button

So I'm setting a button's background doing this:

b.setBackgroundResource(R.drawable.custom_button1); 

How do I programmatically set it back to the default (boring grey) Android button? Is there a R.android.boring_grey resource identifier I can reference without recreating those states myself? Couldn't seem to find it. Maybe my Googling skills are failing me.

Oh and by the way I tried this:

   b.setBackgroundResource(0); 

And the button actually disappeared (blended with black background?).

like image 967
Fraggle Avatar asked Jun 24 '11 18:06

Fraggle


1 Answers

Have you tried this?

android.R.drawable.btn_default; 
like image 69
dymmeh Avatar answered Nov 02 '22 07:11

dymmeh