我想在我的Android項目設置圖像,但有一個錯誤:IMG1不能得到解決或無法在現場
我用這條線,以便於我的Java文件中定義的圖像。 (ImageView
已經在XML文件中創建)。
ImageView imgVw = (ImageView) findViewById(android.R.id.Img1);
另外,我用這條線在我的XML文件:
<ImageView android:id="@+id/Img1" android:scaleType="fitXY"
android:layout_weight="200dp" android:layout_height="0dp"/>
但是當我使用這條線,我得到這個錯誤信息:
Img1 cannot be resolved or is not a field
我打掃我項目沒有任何成功。
使用R.id.Img1 'ImageView的imgVw =(ImageView的)findViewById( R.id.Img1);' – Kunu
我已經使用過,但沒有改變。 – Mohammad
如果你不更新你的問題,似乎你仍然在使用'android.R.id.Img1' –