How to create a Cardview like Google Play

Asked

Viewed 231 times

0

  • Same way in which?!

1 answer

1


The problem is you didn’t define a child main to the cardview. This Child, who will be a viewgroup will organize all other views within the cardview arriving at the result you want.

<android.support.v7.widget.CardView
       android:id="@+id/cardview"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:padding="50dp">

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

                 <TextView
                     android:id="@+id/ads_title"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_margin="10dp"
                     android:text="Melhores preços" />

                 <android.support.v7.widget.RecyclerView
                        android:id="@+id/recycler_ads"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="5dp"
                        android:layout_marginRight="5dp"
                        android:layout_marginTop="40dp"
                        android:scrollbars="none" />

       </LinearLayout>
</android.support.v7.widget.CardView>
  • Thanks, solved my problem!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.