Как да създадете няколко колони на 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