how to refer to a Drawable object by an id of type in
From this page:
public void setBackgroundResource (int resid)
Se开发者_开发知识库t the background to a given resource. The resource should refer to a Drawable object or 0 to remove the background.
So how do I refer to a Drawable object by an int id?
The common use case is
setBackgroundResource(R.drawable.mydrawable)
The R class contains an auto-generated int reference to each drawable resource in the project folder.
This has no use if you generate your Drawable
in code or from any other source than the projects resources (that's why it's called setBackgroundRESOURCE()).
精彩评论