fill_parent设置一个顶部布局或控件强制性让它布满整个屏幕。

wrap_content布局指根据视图内部内容自动扩展以适应其大小。

1. wrap_content

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<Button
android:id="@+id/btnButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button CJP"/>

</RelativeLayout>


2. fill_parent – width

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<Button
android:id="@+id/btnButton1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button CJP"/>

</RelativeLayout>


3. fill_parent – height

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<Button
android:id="@+id/btnButton1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Button CJP"/>

</RelativeLayout>


4. fill_parent – width, height

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<Button
android:id="@+id/btnButton1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Button CJP"/>

</RelativeLayout>

更多相关文章

  1. Android(安卓)代码中动态为RadioGroup添加RadioButton
  2. android之LinearLayout
  3. Android设置布局背景为白色的三种方法
  4. android 可自定义大小和位置的Dialog
  5. Java乔晓松-android使用ImageSwitcher布局的电子相册&服务器获取
  6. android浏览器研究-APP层UI布局
  7. Android(安卓)学习记录-布局预览错误
  8. Android(安卓)文字倾斜
  9. LogCat中不输出任何的信息

随机推荐

  1. Android(安卓)分析内存的使用情况
  2. android调用unity
  3. Android Step by Step (1)——第一个Andr
  4. 基本组件之列表视图
  5. Windows如何配置Android的ADB环境变量
  6. Android(安卓)URL scheme
  7. Android(安卓)ListView 技巧 (一) Androi
  8. Android_TextView属性介绍
  9. android私有目录直接读取
  10. 【android】shape使用总结