0
ArrayList<Bitmap> images = new ArrayList<Bitmap>();
images.add(BitmapFactory.decodeResource(getResources(), R.drawable.uzayli_1));
images.add(BitmapFactory.decodeResource(getResources(), R.drawable.uzayli_2));
mForeground = images.get(0);
mBackground = images.get(1);
我可以將圖片添加到ArrayList,但我想在其他類中使用該類,所以我必須爲它編寫一個方法。使用方法將圖像添加到位圖ArrayList?
public void addImages(ArrayList<Bitmap> images){
for (int i = 0; i < images.size(); i++) {
images.get(i);
mPages.add(BitmapFactory.decodeResource(getResources(), R.drawable.));
}
}
我想要類似這樣的東西,但是我怎樣才能定義可繪製的圖像之後,R.drawable。在一個方法?
什麼是mPages? –