》All resource IDs are defined in your project's R
class, which the aapt
tool automatically generates.
》两种获取资源的方法:In code: Using a static integer from a sub-class of your R
class;In code: Using a static integer from a sub-class of your R
class。
》mageView
to use the res/drawable/myimage.png
resource using setImageResource()
:
ImageView imageView = (ImageView) findViewById(R.id.myimageview); imageView.setImageResource(R.drawable.myimage);