ScrollView match_parent_ScrollView无法填充满屏幕
2014-11-14 11:59:45 By: shinyuu
ScrollView滚动视图是指当拥有很多内容、屏幕显示不完时、需要通过滚动跳来显示的视图、Scrollview的一般用法如下、以下代码在Scrollview里面放了一个RelativeLayout、并且是设置为android:layout_height="match_parent"填充全屏的、RelativeLayout里面放置了一个TextView背景设为了一张图片、按照代码理解、图片应该是居于屏幕的最下方的
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/common_background" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" android:background="@drawable/bottom_bg" /> </RelativeLayout> </ScrollView>
但是最后运行的效果是这样的、你会发现图片并没有局到整个屏幕的下边、而是在上面
那么要怎么解决这个问题呢、最后我在查看文档的时候发现了这样一个属性、设置了就可以解决这个问题了
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" > </ScrollView>
也就是说设置ScrollView的android:fillViewport为true、即 android:fillViewport="true"即可
若资源对你有帮助、浏览后有很大收获、不妨小额打赏我一下、你的鼓励是维持我不断写博客最大动力
想获取DD博客最新代码、你可以扫描下方的二维码、关注DD博客微信公众号(ddblogs)
或者你也可以关注我的新浪微博、了解DD博客的最新动态:DD博客官方微博(dwtedx的微博)
如对资源有任何疑问或觉得仍然有很大的改善空间、可以对该博文进行评论、希望不吝赐教
为保证及时回复、可以使用博客留言板给我留言: DD博客留言板(dwtedx的留言板)
感谢你的访问、祝你生活愉快、工作顺心、欢迎常来逛逛