Android 中fill_parent与wrap…
来源:互联网 发布:手机条码生成软件 编辑:程序博客网 时间:2024/05/17 07:55
在Android中,对于组件的属性“layout_width”和“layout_height”, 2. fill_parent:组件会显示得和其父组件一样大,并填充剩余的空间(在 API Level8中命名为 match_parent)。
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FINISH"/>
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="FINISH"/>
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="FINISH"/>
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="FINISH"/>
其值总是设置为“wrap_content”或“fill_parent”。
那么,这两个值有什么不同呢? 请看下面的定义:
1. wrap_content:组件的大小以能装入其内容即可;
eg:
1.设置为warp_parent
放置一个Button组件,并设置其宽度和高度为wrap_parent,这会告诉Android将按钮显示为能够装下其内容。
2.设置宽为fill_parent
将layout_width的值改为fill_parent,现在按钮的宽度填充了剩余的空间,与其父组件Textview的宽度一样,单高度依然是保持在紧紧能容纳下内容。
3.设置高度为fill_parent
将layout_width的值改为fill_parent,现在按钮的宽度填充了剩余的空间,与其父组件Textview的宽度一样,单高度依然是保持在紧紧能容纳下内容。
4.设置为fill_parent
设置其宽度和高度为wrap_parent,这会告诉Android将按钮显示为与整个屏幕一样大,它将填充整个屏幕空间
实际上,我们可以指定确切的宽度和高度,不过不建议这样做,因为Android有多种设备屏幕尺寸。我们不知道我们的应用程序会跑在哪一种尺寸的Android设备上。。。。
0 0
- Android 中fill_parent与wrap…
- Android中fill_parent与match_parent的区别
- Android 中fill_parent与wrap_content的区别
- Android 中fill_parent与wrap_content的区别
- Android 中fill_parent与wrap_content的区别
- android开发中MATCH_PARENT和FILL_PARENT的区别与联系
- [Android]fill_parent与match_parent区别
- Android中fill_parent和match_parent的区别?
- android中fill_parent,match_parent,wrap_parent的区别
- Android中fill_parent、wrap_content、match_parent的区别
- Android中fill_parent、match_parent和wrap_content
- android:phoneNumber 与&nbsp…
- android 布局中 layout_…
- Anroid 中fill_parent与 match_parent的区别与使用
- Android Bander设计与实现 - 设计…
- jQuery中wrap、wrapAll和wrapInner…
- Android之wrap_parent,match_parent,fill_parent的区别与联系
- Android开发中wrap_content和fill_parent的区别
- nginx与zookeeper交互,同步数据,发送系统负载信息。
- PL/SQL创建简单的触发器trig…
- Java JDK环境变量配置
- 如何配置 Android SDK 以及A…
- Android中Activity的生命周期
- Android 中fill_parent与wrap…
- Android 一张图理解getWidth…
- 多线程CreateThread与临界区Create…
- CreateThread与_beginthreadex
- 线程的终止_beginthread和_endthre…
- 分享一个SQLyog 8.14的注册…
- JAVA中JButton常用设置
- 走走停停写写画画
- mktime 夏令时