Skip to content

Instantly share code, notes, and snippets.

@trinhlbk1991
Last active September 24, 2015 05:50
Show Gist options
  • Select an option

  • Save trinhlbk1991/6398c3f8ed11259c5ead to your computer and use it in GitHub Desktop.

Select an option

Save trinhlbk1991/6398c3f8ed11259c5ead to your computer and use it in GitHub Desktop.
Set View's background drawable programmatically
final int version = android.os.Build.VERSION.SDK_INT;
if(version < android.os.Build.VERSION_CODES.JELLY_BEAN) {
layout.setBackgroundDrawable( getDrawable(context, R.drawable.ready) );
} else {
layout.setBackground( getDrawable(context, R.drawable.ready));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment