android ——— RecyclerView的item的居中问题

item的靠左的2种写法:

1.

public ViewHolder onCreateViewHolder(ViewGroup parent, intviewType) {

View view = View.inflate(mActivity,R.layout.item_expand_recylerview, null);

ViewHolder vh =newViewHolder(view);

return vh;

}

2.View view = LinearLayout.inflate(mActivity,R.layout.item_expand_recylerview, null);


3.item居中的写法,要把parent 传进去

View view = LayoutInflater.from(mActivity).inflate( R.layout.item_expand_recylerview,parent,false);

你可能感兴趣的:(android ——— RecyclerView的item的居中问题)