美文网首页
ConstraintLayout 布局中 recycleview

ConstraintLayout 布局中 recycleview

作者: 五谷观精分道长 | 来源:发表于2017-11-29 18:01 被阅读64次

首先排除布局设置问题

正确设置:

inflate(LayoutInflater.from(context), R.layout.test_item, parent, false);

注意 false很重要

我的问题

在ConstraintLayout当父布局的情况下,设置recycleview为match parent ,造成如此情况。

ConstraintLayout 建议不要使用match parent(是过时的方法),虽然也能充满父布局,但是会造成不良的反应(而且是未知的)。应该用any_size代替它。

参考文章:ConstraintLayout 使用手册

相关文章

网友评论

      本文标题:ConstraintLayout 布局中 recycleview

      本文链接:https://www.haomeiwen.com/subject/kedpbxtx.html