4
我正在開發一個顯示圖像的android應用程序。我正在使用grid view
在我的應用程序中顯示圖像。如何在GridView android中獲得垂直滾動?
但默認的gridview是horizontal scrolling
我想顯示在vertical scrolling
網格視圖中的圖像。
請建議我一種在gridview中實現垂直滾動的方法。
在此先感謝。
我正在開發一個顯示圖像的android應用程序。我正在使用grid view
在我的應用程序中顯示圖像。如何在GridView android中獲得垂直滾動?
但默認的gridview是horizontal scrolling
我想顯示在vertical scrolling
網格視圖中的圖像。
請建議我一種在gridview中實現垂直滾動的方法。
在此先感謝。
使用android:numColumns="3" // this will force gridview to have 3 columns and if you have more than 3 items in grid view, you can have vertical scrolling.
例:
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridView1"
android:numColumns="3"
android:gravity="center"
android:columnWidth="50dp"
android:stretchMode="columnWidth"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</GridView>
感謝您的答覆。但我不想橫向滾動。我的意思是,如果我有12張圖片,我想在第一張圖中顯示4,在下一張圖中顯示下一張4。我想要幾乎像畫廊,但有4個圖像視圖 –
沒關係,所以只是而不是3,使用4作爲numOfCloumns ..這將滿足您的要求..對嗎? – Shrikant
如果您的問題可以通過使用GridView解決,爲什麼使用佈局? – Shrikant