📌  相关文章
📜  水平 recyclerview 项目宽度一半的屏幕 android - Kotlin 代码示例

📅  最后修改于: 2022-03-11 14:53:32.395000             🧑  作者: Mango

代码示例2
@Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.design_item, parent, false);
        v.setLayoutParams(new ViewGroup.LayoutParams((int) (parent.getWidth() * 0.5),ViewGroup.LayoutParams.MATCH_PARENT));

        return new ViewHolder(v);
    }