Image array in android

前端 未结 3 1866
眼角桃花
眼角桃花 2021-02-04 10:59

I am trying to use an array of images then set my ImageView to one of the images in the array. My first instinct was to use an array of strings with the image names but this did

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 11:37

    depends where your images are

    but if there a in R.drawables. then why not simply store the int reference in your array and then load that

    if you want to do treatment on them you can also open the Bitmap and store that

    edit:

      private int[] textureArrayWin = {
    R.drawable.star_00,
    R.drawable.star_01,
    R.drawable.star_02,
    };
    

    and now you have a table of the id of the images you want

提交回复
热议问题