So I follow an Android tutorial from ude*y, everything works perfectly, the only problem is the first and last item of cardview not showing correctly.
Asked
Active
Viewed 248 times
0
-
Could you add xml of you cardview element and the code used for setup RecyclerView? – Gianluca Benucci Mar 01 '19 at 16:26
-
1Share your XML's with us. But from what I see, your recyclerview is not bellow the toolbar. You have to set it bellow the toolbar or give it a margin top – Pedro Oliveira Mar 01 '19 at 16:27
-
Welcome to so,your question is too broad - please read [How to ask good question](https://stackoverflow.com/help/how-to-ask) – Tamir Abutbul Mar 01 '19 at 16:27
-
Please share you XML code for `CardView` and `MainActivity`. – TheCoderGuy Mar 01 '19 at 18:38
1 Answers
0
I think you have to margin or padding as your requirement.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
<TextView
android:id="@+id/empty_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="@drawable/tryagain"
android:gravity="center"
android:visibility="gone"
android:text="@string/no_data_available" />
</RelativeLayout>
</LinearLayout>
You want see more full card view example, please following this github:
https://github.com/dharmakshetri/CardViewExample/blob/master/app/src/main/res/layout/main.xml
and full source code: CardViewExample

Horrorgoogle
- 7,858
- 11
- 48
- 81