开发者

Android: GridView ImageAdapter can't refer to R.drawable icons - They are missing

开发者 https://www.devze.com 2023-01-22 01:37 出处:网络
I\'ve run the HelloWorld without problem, but the GridView will not work. The Sample_0, Sample_1, etc icons are not visible in the R class within the ImageAdapter file.

I've run the HelloWorld without problem, but the GridView will not work. The Sample_0, Sample_1, etc icons are not visible in the R class within the ImageAdapter file. They ARE visible within the main class.

Going back to the HelloWorld example, I noticed there is an 'icon' in each drawable for three resolutions. So as a test, I created a new class to access it, ( and yes I did import android.R) Sadly, the R class does not refer to icon.png.

The on开发者_如何学Cly place where R.drawable.icon exists is in the main class.

Why does my R class (which is correctly generated with a reference to icon.png) not seem to be the same in a new java class file?

Help! Jurimo


You're importing the wrong R. You're almost certainly importing android.R. You can't do that. You don't need to import R since it's within your package.

0

精彩评论

暂无评论...
验证码 换一张
取 消