我需要實現轉移列在GridView控件看起來像這樣機器人的GridView移1列
但只有兩列。 我曾嘗試在適配器兩個用不同的類型,但它並沒有解決我的任務
在我看來,我將不得不延長GridView和ovverride的onDraw方法,但也許已經存在另一種解決方案或庫?
我需要實現轉移列在GridView控件看起來像這樣機器人的GridView移1列
但只有兩列。 我曾嘗試在適配器兩個用不同的類型,但它並沒有解決我的任務
在我看來,我將不得不延長GridView和ovverride的onDraw方法,但也許已經存在另一種解決方案或庫?
這可以通過佈局XML文件來完成。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
<GridView
android:id="@+id/grid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/header"
android:cacheColorHint="#0000"
android:columnWidth="100dp"
android:horizontalSpacing="5dp"
android:numColumns="2"
android:stretchMode="columnWidth"
android:verticalSpacing="5dp" />
</RelativeLayout>
請參考下面的鏈接,代碼可用。 希望這會幫助你。 StaggeredGridView
StraggeredGridView - exacltly我需要的。 Thx,會嘗試 – 2014-09-03 13:40:45
使用'GridLayout'。它允許不均勻的網格。通過導入支持庫,它也可用於較早的設備。 – 2014-09-03 13:30:21