答案 0 :(得分:0)
我认为您必须按需留白或填充。
<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>
您想查看更多完整的卡片视图示例,请遵循以下github:
https://github.com/dharmakshetri/CardViewExample/blob/master/app/src/main/res/layout/main.xml
和完整的源代码: CardViewExample