我有多個CardView
的在XML定義爲:如何製作可變高度CardViews的網格佈局?
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
card_view:cardPreventCornerOverlap="false"
card_view:cardCornerRadius="4dp">
<LinearLayout
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:textSize="@dimen/abc_text_size_title_material"
android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.CardView>
對於電話,我已包裹所述多個CardView
的在垂直LinearLayout
:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
對於片劑,我想改爲使用網格佈局,類似於Material Design specs中使用的設計,請參閱圖像here。
用於製作網格佈局的最佳ViewGroup
是什麼?這些卡的高度可變,並且具有靜態內容。
GridLayout
不能使用,因爲卡的高度是可變的。
第二種選擇是最好的我猜.. – Hardy