RecycleView

item无法充满的问题

Adapter的Holder加载布局使用View会造成无法填充满,使用LayoutInflater。
填充不满

 override fun onCreateViewHolder(p0: ViewGroup, p1: Int): BuilderRecyclerViewHolder {
            var view = View.inflate(context,R.layout.item_maintenance_request_history,null);
            return BuilderRecyclerViewHolder(view)
 }

正确填充

 override fun onCreateViewHolder(p0: ViewGroup, p1: Int): BuilderRecyclerViewHolder {
            var view = LayoutInflater.from(context).inflate(R.layout.item_maintenance_request_history, p0, false);
            return BuilderRecyclerViewHolder(view)
 }

你可能感兴趣的:(Android)