RecyclerView的item的设置math_parent显示不全

来源:互联网 发布:程序员开发工具网 编辑:程序博客网 时间:2024/05/22 09:00

解决方案

创建onCreateViewHolder的时候使用三个参数的打气筒,如下

对的方式,解决。 mView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.newhouse_detil_detil, parent, false); 错的方式 mView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.newhouse_detil_detil, null);

问题如下两张图片,明明写的是match_parent却显示不全,

<LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:background="#f00"    android:orientation="vertical">

这里写图片描述
这里写图片描述

0 1
原创粉丝点击