Как создать несколько столбцов CardViews

Я пытаюсь создать фрагмент с несколькими столбцами CardViews:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="3dp"
    android:orientation="horizontal" >

 <android.support.v7.widget.CardView
     android:layout_gravity="center"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     app:cardElevation="2dp"
     app:cardCornerRadius="3dp">
         <TextView
             android:text           = "column 1"
             android:layout_width   = "wrap_content"
             android:layout_height  = "wrap_content" />
    </android.support.v7.widget.CardView>


    <android.support.v7.widget.CardView
        android:layout_gravity="center"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:cardElevation="2dp"
        app:cardCornerRadius="3dp">
                <TextView
                    android:text           = "column 2"
                    android:layout_width   = "wrap_content"
                    android:layout_height  = "wrap_content" />
    </android.support.v7.widget.CardView>

 </LinearLayout>

Но я вижу только первые CardView на полную ширину. Второй CardViews не показан.

Что я делаю неправильно?


person Tapa Save    schedule 29.04.2015    source источник


Ответы (1)


Установите android:layout_weight="1" в обоих карточках

person Willi Ye    schedule 29.04.2015