【发布时间】:2017-07-12 16:56:15
【问题描述】:
我想检查 Imageview 是否有特定的 R.drawable,如果有,请用另一个图像更改它。但是这样不行。
xml代码
<ImageView
android:id="@+id/Picture"
android:src="@drawable/apicture"
</ImageView>
java代码
Image = (ImageView) findViewById(R.id.Picture);
public void coolMethod()
{
if(Image.equals(R.drawable.apicture){
Image.setImageResource(R.drawable.anotherpicture);
}
}
【问题讨论】: