8

I have multiple CardView's defined in XML as:

<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>

For phones, I have wrapped the multiple CardView's in a vertical LinearLayout:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

For tablets, I would like to use a grid layout instead, similar to the design used in the Material Design specs, see image here.

What's the best ViewGroup to use to make the grid layout? The cards are of variable height, and have static content.

GridLayout can't be used, because the cards are of variable height.

user2560886
  • 1,910
  • 2
  • 14
  • 20

1 Answers1

1

For tablets you can use 2 LinearLayouts.

NoobyGuy
  • 19
  • 3