NestedScrollView属性fillViewport解决android布局不能撑满全屏的问题

使用最新的NestedScrollView时候addview子布局不能撑满整个屏幕,解决办法就是android:fillViewport="true"增加这个属性即可,

这个属性允许 NestedScrollView中的组件去充满它。 当NestedScrollView没有fillVeewport=“true”时, 里面的元素(比如LinearLayout)会按照wrap_content来计算(不论它是否设了"fill_parent"),而如果LinearLayout的元素设置了fill_parent,那么也是不管用的,因为LinearLayout依赖里面的元素,而里面的元素又依赖LinearLayout,这样自相矛盾.所以里面元素设置了fill_parent,也会当做wrap_content来计算.

你可能感兴趣的:(NestedScrollView属性fillViewport解决android布局不能撑满全屏的问题)