Android 隨機變化圖片

int[] Srcimagers={R.drawable.shake,R.drawable.shake1,R.drawable.shake2,R.drawable.shake3};
	//隨機生成圖片
					Random random=new Random();
					int strImage=Srcimagers[random.nextInt(4)];
					//圖片路徑
					imageView.setImageResource(strImage);
random.nextInt(4)生成的隨機數是0,1,2,3,
發佈了53 篇原創文章 · 獲贊 10 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章