onCreateView 里match parent失效的写法
View.inflate(
context,
R.layout.item_part_bottomsheet,
null
)
好用写法:
LayoutInflater.from(parent.context)
.inflate(R.layout.item_parts_detail_notice, parent, false)

本文探讨了在onCreateView方法中使用matchParent属性时可能遇到的问题,并提供了一种有效解决策略。通过对比两种不同的View inflate方法,文章详细解释了LayoutInflater.from(context).inflate的正确使用方式,确保子View能正确填充父布局。

742

被折叠的 条评论
为什么被折叠?



