前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Android ScrollView无法填充满屏幕的解决办法

Android ScrollView无法填充满屏幕的解决办法

作者头像
砸漏
发布2020-10-22 11:09:03
1.4K0
发布2020-10-22 11:09:03
举报
文章被收录于专栏:恩蓝脚本

Android ScrollView无法填充满屏幕的解决办法

ScrollView滚动视图是指当拥有很多内容、屏幕显示不完时、需要通过滚动跳来显示的视图、Scrollview的一般用法如下

以下代码在Scrollview里面放了一个RelativeLayout、并且是设置为Android:layout_height=”match_parent“填充全屏的和RelativeLayout里面放置了一个TextView背景设为了一张图片、按照代码理解、图片应该是居于屏幕的最下方的

代码语言:javascript
复制
<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无法填充满屏幕,

那么要怎么解决这个问题呢、最后我在查看文档的时候发现了这样一个属性、设置了就可以解决这个问题了

代码语言:javascript
复制
<ScrollView
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:fillViewport="true"  

</ScrollView 

也就是说设置ScrollView的android:fillViewport为true、即 android:fillViewport=”true”即可

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-09-11 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档