我改变了这个int []
int[] imageID;
= {
R.drawable.farm_small,
R.drawable.scroll_small,
R.drawable.desert_small,
R.drawable.bg_blue_small,
R.drawable.city_small,
R.drawable.clip_small,
R.drawable.grass_small,
R.drawable.green_leaves_small,
R.drawable.moon_landscape_small,
R.drawable.prismatic_floruish_small,
R.drawable.technologic_small,
R.drawable.white_small,
R.drawable.red_small,
R.drawable.bllue_small,
R.drawable.yellow_small
};
到string.xml
<array name="drawable_positions">
<item>@drawable/farm_small</item>
<item>@drawable/scroll_small</item>
<item>@drawable/desert_small</item>
<item>@drawable/bg_blue_small</item>
<item>@drawable/city_small</item>
<item>@drawable/clip_small</item>
<item>@drawable/grass_small</item>
<item>@drawable/green_leaves_small</item>
<item>@drawable/moon_landscape_small</item>
<item>@drawable/prismatic_floruish_small</item>
<item>@drawable/technologic_small</item>
<item>@drawable/white_small</item>
<item>@drawable/red_small</item>
<item>@drawable/bllue_small</item>
<item>@drawable/yellow_small</item>
</array>
我在这里初始化所有内容:imageID = res.getIntArray(R.array.drawable_positions);
但现在当我加入这个图片的菜单时,我无法看到它们。我不知道为什么。
这是myAdapter:
RecyclerViewForBackground mAdapter = new RecyclerViewForBackground(web, imageID);
这里是它的构造函数:
RecyclerViewForBackground(String[] web, int[] img) {
this.web = web;
this.img = img;
}