且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[Android Pro] ScrollView使用fillViewport设置高度为MatchParent

更新时间:2022-08-20 10:55:13

reference to : http://blog.csdn.net/u012975705/article/details/49275001

之前遇到一问题,就是当使用ScrollView时,ScrollView控件里的布局无法充满整个手机屏幕,通过阅读源码发现,ScrollView中有个mFillViewport属性:

[Android Pro] ScrollView使用fillViewport设置高度为MatchParent

When set to true, the scroll view measure its child to make it fill the currently visible area

大概意思就是当mFillViewport设置为true的时候,其子视图能够自动填充满当前可见的整个区域。即,在xml布局文件中为ScrollView控件添加

android:fillViewport="true"
能使ScrollView里的元素填满整个ScrollView。
 
分类: Android Pro
本文转自demoblog博客园博客,原文链接http://www.cnblogs.com/0616--ataozhijia/p/6048418.html如需转载请自行联系原作者

demoblog