對於我正在創建的Android應用程序,我想擁有一個簡單的圖片庫。理想情況下,它將是一個帶有水平滾動條的單行圖像(很像這樣:http://www.appszoom.com/android_applications/multimedia/3d-gallery_hbij.html,儘管3D效果不是必需的)。Android:創建圖片庫
我知道Android API曾經擁有Gallery
類,本來是完美的,但現在這已被棄用。現在,我已經成功使用LinearLayout
和HorizontalScrollView
這樣
XML創建一個簡單的畫廊:
<HorizontalScrollView
android:id="@+id/hor_scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/gallery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" />
</HorizontalScrollView>
美學,這是完美的;看我究竟是怎麼想的(我沒有看到張貼我的代碼的意義,但我很樂意應要求)。這個問題在於功能。用戶有能力從圖庫列表中選擇圖像很重要,但使用我目前的方法這似乎是不可能的。我讀過ViewPager
也可以使用,但從我的理解,似乎這也不可能從中選擇個別圖像。 GridView
將是我的下一個選擇,因爲您可以實施OnItemClickListener
但是當然這會在用戶拍攝照片時動態添加列。
所以我的問題很簡單:我該如何去實現選擇個人圖像的這種功能?
最後說明:我對Android編程頗爲陌生,但對Java非常熟練。