所以我按照ude*y的Android教程,一切都运行得很好,唯一的问题是cardview的第一项也是最后一项显示不正确。
发布于 2019-03-01 16:40:53
我想你必须按你的要求留边或补齐。
<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
https://stackoverflow.com/questions/54948618
复制相似问题