gpt4 book ai didi

java - 将 int[] 更改为 IntArray 导致无法在应用程序中加载图像

转载 作者:行者123 更新时间:2023-12-01 09:03:37 27 4
gpt4 key购买 nike

我改变这个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);

但是现在当我用这些图像加入菜单时我看不到它们。我不知道为什么。

这是我的适配器:

RecyclerViewForBackground mAdapter = new RecyclerViewForBackground(web, imageID);

这是它的构造函数:

RecyclerViewForBackground(String[] web, int[] img) {
this.web = web;
this.img = img;
}

最佳答案

尝试使用integer-array标签而不是数组

关于java - 将 int[] 更改为 IntArray 导致无法在应用程序中加载图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41472005/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com