我需要获取一些ImageButton的背景资源,以便稍后重复使用。为了设置背景,我使用了setBackgroundResource方法。但我找不到任何获取背景资源的方法。
private void AddImage(int img){
ImageButton imgact1 = (ImageButton)findViewById(R.id.imgact1);
ImageButton imgact2 = (ImageButton)findViewById(R.id.imgact2);
ImageButton imgact3 = (ImageButton)findViewById(R.id.imgact3);
imgact3.setBackgroundResource(img);
}
感谢您的帮助。