android - Android cardview 第一项和最后一项未正确显示
解决方案
我认为您必须根据需要设置边距或填充。
<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
推荐阅读
- button - MainActivity 无法识别 activity_main(layout)(kotlin)(fixed) 中的项目,您可以查看我的评论以获取答案
- python - sklearn train_test_split 错误:发现输入变量的样本数不一致
- reactjs - 如何根据外键选择循环遍历多个数组
- android - 状态栏中的这个图标叫什么?
- c# - 在 C# 中通过 TCP 套接字方法发送位类型数据
- java - AES 解密期间出错。非法块大小异常
- android - 关闭警报对话框
- wordpress - 复杂重定向的组合或重写规则
- usb - Windows 7 虚拟机无法识别具有最新 Virtualbox 扩展的 USB 密钥和该密钥的过滤器
- android - 问题在 Honor 6x 中不可见项目(带有 StaggeredGridLayoutManager 的 Recyclerview)