作业帮 > 综合 > 作业

android:fillViewport=\"true\" 什么意思

来源:学生作业帮 编辑:灵鹊做题网作业帮 分类:综合作业 时间:2024/05/16 17:27:50
android:fillViewport=\"true\" 什么意思
android:fillViewport=\
ScrollView里只放一个元素.
当ScrollView里的元素想填满ScrollView时,使用"fill_parent"是不管用的,必需为ScrollView设置:android:fillViewport="true".
当ScrollView没有fillVeewport=“true”时,里面的元素(比如LinearLayout)会按照wrap_content来计算(不论它是否设了"fill_parent"),而如果LinearLayout的元素设置了fill_parent,那么也是不管用的,因为LinearLayout依赖里面的元素,而里面的元素又依赖LinearLayout,这样自相矛盾.所以里面元素设置了fill_parent,也会当做wrap_content来计算.