android中RelativeLayout无法填充ScrollView布局的问题

ScrollView是解决布局过长的情况下使用,一遍其下面会有个顶部布局,我项目里面是RelativeLayout,但是RelativeLayout无论设置

android:layout_height="wrap_content"

还是

android:layout_height="match_content"

都无法解决RelativeLayout填充ScrollView整过view的情况,后来百度了下,发现在scrollview添加如下android:fillViewport="true"代码可以解决。

当ScrollView没有fillVeewport=“true”时,里面的元素(比如LinearLayout)会按照wrap_content来计算(不论它是否设了"fill_parent")

原文地址:https://www.cnblogs.com/androidsuperman/p/4980689.html