2011-09-20 70 views
1

我有一個靜態數組。將圖像從數組加載到圖像視圖並使用鰭狀肢顯示下一個或上一個

private Integer[] mThumbIds = { 
     R.drawable.sample_0, R.drawable.sample_1, 
     R.drawable.sample_2, R.drawable.sample_3, 
     R.drawable.sample_4, R.drawable.sample_5, 
     R.drawable.sample_6, R.drawable.sample_7, 
     R.drawable.sample_0 
} 

現在我必須在圖像視圖中逐個顯示這些圖像,並在鰭狀肢(或其他)的幫助下顯示上一個或下一個圖像。 第一個問題如何在圖像視圖中加載這些圖像。 如果您可以提供一些示例代碼,那對我來說很好。 謝謝。

+0

http://developer.android.com/resources/tutorials/views/hello-gallery.html –

回答

0

您可以像這樣使用數組顯示圖像。

int id= mThumbIds[5]; 

youImageView.setBackgroundDrawable(getResources().getDrawable(id)) 
0

我在自定義圖庫視圖的幫助下解決了這個問題。你可以在圖庫視圖中使用圖庫視圖適配器類,你應該給圖像視圖的高度和寬度fill_parent。

您可以創建自定義圖庫視圖像how to stop scrolling gallery?

看到上面的鏈接,並做等。這將是有幫助的ü..

感謝&問候, MMRPs

相關問題