android scrollView 内部子布局MATCH_PARENT却无法填充满屏幕问题
来源:互联网 发布:漫威电影观看顺序知乎 编辑:程序博客网 时间:2024/05/18 03:28
ScrollView滚动视图是指当拥有很多内容、屏幕显示不完时、需要通过滚动跳来显示的视图、Scrollview的一般用法如下、以下代码在Scrollview里面放了一个RelativeLayout、并且是设置为android:layout_height="match_parent"填充全屏的,但是测试以后不起作用。布局如下:
<ScrollViewandroid:layout_width="match_parent"android:layout_height="match_parent" ><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="@color/common_background" ><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerHorizontal="true"android:layout_alignParentBottom="true"android:background="@drawable/bottom_bg" /></RelativeLayout></ScrollView>
查看android API 获知,
其中白色部分是scrollView,灰色部分是TextView,很明显,scrollview(白色)已经扩展到最大高度了,但是其内部的
可明明TextView的TextView
(灰色)却没有扩展.layout_height=
"fill_parent",为什么没占满呢?是因为TextView的上层LinearLayout为wrap_content的原因吗?
但是换成
fill_parent
还是一样的(实际上Scrollview的第一层View的layout_weight在sdk中是建议为wrap_content
的)。
后来在stackoverflow上找到了原因: http://stackoverflow.com/questions/2599837/linearlayout-not-expanding-inside-a-scrollview
要让ScrollView内部元素的 fill_parent 起作用必须设置
android:fillViewport="true"
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true">
转自:http://blog.csdn.net/zhzzhz123456/article/details/47808523
阅读全文
0 0
- android scrollView 内部子布局MATCH_PARENT却无法填充满屏幕问题
- android scrollView 内部子布局MATCH_PARENT却无法填充满屏幕问题
- android scrollView 内部子布局无法充满屏幕- LinearLayout not expanding inside a ScrollView
- ScrollView无法填充满屏幕
- 5.ScrollView无法填充满屏幕
- SCROLLVIEW MATCH_PARENT_SCROLLVIEW无法填充满屏幕
- 解决scrollview 子布局不能充满屏幕的问题
- android ScrollView 充满屏幕
- ScrollView中设置子控件填充满ScrollView
- 笔记:ScrollView中布局高度无法match_parent
- ImageView设置了match_parent无法充满父布局解决方案
- ScrollView子布局如何充满全屏
- 【Android基础】android ScrollView 充满屏幕
- Android RecyclerView关于item无法充满屏幕的问题
- ScrollView充满屏幕
- Android 关于ScrollView的子布局无法设置高度的问题
- 安卓开发——ScrollView中设置子控件填充满ScrollView
- 使ScrollView充满布局
- 姐姐给我推荐的两个期刊数据库索引
- Windows Android Studio安装教程
- 网页上不可选中文字的那些事儿
- 移动端样式小技巧
- 结对编程的第1例:主要着眼于,解决RecyclerView的头部伸缩时,抖动的功能
- android scrollView 内部子布局MATCH_PARENT却无法填充满屏幕问题
- 时间工具类方法-Java实现
- MVP
- Java在web页面上中文URL乱码解决
- 线程中CreateEvent和SetEvent及WaitForSingleObject
- Sequence discriminative training
- mac 终端 常用命令
- Rehashing
- 牛顿插值函数C语言程序实现