How to create a CardView equal to Google Play

0

Good morning, I'm trying to create a layout just like Google Play, but I'm not sure how to do the design. Could you help me?

link

XML code link
link

    
asked by anonymous 03.08.2017 / 17:02

1 answer

1

The problem is that you have not set a child master for cardview . This child, which will be a viewgroup , will organize all the other views within the cardview getting to 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>
    
03.08.2017 / 17:49