例子,在ScrollView下加入的组件,无论如何也不能自动扩展到屏幕高度。

布局文件。

[html]
<?xml version="1.0" encoding="utf-8"?>
<!-- 背景:蓝色 -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#0000ff" >

<!-- 背景:绿色 -->

<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00ff00" >

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="HelloAndroid." >
</TextView>
</LinearLayout>

</ScrollView>

效果图。

.

尽管已经设置了android:layout_height="fill_parent",但是,整个LinearLayout和TextView还是不能充满整个屏幕。


解决办法。

在ScrollView中添加一个android:fillViewport="true"属性就可以了。顾名思义,这个属性允许ScrollView中的组件去充满它。


修改后的效果图

(转自:http://www.2cto.com/kf/201208/148262.html)

更多相关文章

  1. Android四大基本组件介绍与生命周期
  2. Android四大组件的理解
  3. TabHost与RadioGroup结合完成的菜单【带效果图】5个Activity
  4. 第三章 Android程序设计基础
  5. Android开发——Android搜索框架(二)
  6. android用户界面-组件Widget-地图视图MapView
  7. Android(安卓)组件资源库
  8. android用户界面-组件Widget-画廊视图Gallery
  9. [Android] ACTION_GET_CONTENT与ACTION_PICK的区别

随机推荐

  1. centos系统安装redis4.0(单机)
  2. 对linux字符设备的理解(整体架构)
  3. 【嵌入式Linux学习七步曲之第五篇 Linux
  4. 如何查看最近安装的rpms?
  5. Uncompressing Linux... done, booting t
  6. 小米随身WiFi,Linux下AP热点驱动(开源)
  7. 走近Linux世界:Linux与Windows特性比较
  8. linux系统时间和硬件时钟问题(date和hwcl
  9. Linux 下串口编程之三 termios结构体介绍
  10. Linux上配置使用iSCSI详细说明