0

I'm using custom background in my app. What i'm looking for is how to get default drawable from android.R. This because if a user select white or dark background, i don't wanna use a custom image, but use for ex: @android:drawable/screen_background_light (so, it doesn't take space to save an image).

If i try to import android.R.* errors occours (that because im using the other file R).

I know how to do it by XML by doing android:background=@android:drawable/screen_background_light" , but this is now what i want to do.

Stefano Munarini
  • 2,711
  • 2
  • 22
  • 26

1 Answers1

0

Do not import android.R.*.

If you want to use the drawable that's in android package use android.R.drawable.screen_background_light

Example: say for button set the btn_plus drawable as background

   Button b = new Button(ActivityName.this);
   b.setBackgroundResource(android.R.drawable.btn_plus);
Raghunandan
  • 132,755
  • 26
  • 225
  • 256