android_14 线性布局
来源:互联网 发布:山中鹿之介 数据 编辑:程序博客网 时间:2024/06/11 14:43
Either attribute can be applied to View's (visual control) horizontal or vertical size. It's used to set a View or Layouts size based on either it's contents or the size of it's parent layout rather than explicitly specifying a dimension.
两个属性都用来适应视图的水平或垂直大小,一个以视图的内容或尺寸为基础的布局比精确地指定视图范围更加方便。
fill_parent
Setting the layout of a widget to fill_parent will force it to expand to take up as much space as is available within the layout element it's been placed in. It's roughly equivalent of setting the dockstyle of a Windows Form Control to Fill.
设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间。这跟Windows控件的dockstyle属性大体一致。
Setting a top level layout or control to fill_parent will force it to take up the whole screen.
设置一个顶部布局或控件为fill_parent将强制性让它布满整个屏幕。
wrap_content
Setting a View's size to wrap_content will force it to expand only far enough to contain the values (or child controls) it contains. For controls -- like text boxes (TextView) or images (ImageView) -- this will wrap the text or image being shown. For layout elements it will resize the layout to fit the controls / layouts added as its children.
设置一个视图的尺寸为wrap_content将强制性地使视图扩展以显示全部内容。以TextView和ImageView控件为例,设置为wrap_content将完整显示其内部的文本和图像。布局元素将根据内容更改大小。
It's roughly the equivalent of setting a Windows Form Control's Autosize property to True.
设置一个视图的尺寸为wrap_content大体等同于设置Windows控件的Autosize属性为True。
老外说得复杂,简言之:
fill_parent布局指将视图(在Windows中称为控件)扩展以填充所在容器的全部空间。
wrap_content布局指根据视图内部内容自动扩展以适应其大小。
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="right" > <Button android:layout_width="wrap_content"(这里不能用fill) android:layout_height="wrap_content" android:text="确定" /> <Button android:layout_width="wrap_content"(这里不能用fill) android:layout_height="wrap_content" android:text="取消" /> </LinearLayout></LinearLayout>
- android_14 线性布局
- android_14 线性布局2
- 线性布局
- 线性布局
- 线性布局
- 线性布局
- 线性布局
- 线性布局
- 线性布局
- 线性布局
- 线性布局 相对布局 参数
- android布局之线性布局
- android布局之线性布局
- 安卓布局--线性布局
- Android布局之线性布局
- 自定义UICollectionView布局-线性布局
- Android布局之线性布局
- android 布局学习---线性布局
- 深入理解 GraphQL
- Java语法(一)基本语法(think in java 笔记)
- 利用PickerView完成地址选择器(省市二级联动)
- android_12 activity 保存状态
- AngularJs出现错误Error: [ng:areq]
- android_14 线性布局
- Java语法(二)运算符
- grub rescue问题解决
- 拓扑排序的原理及其实现
- signal 11 (SIGSEGV),code 1,fault addr 0x0 和 Fatal signal 6 (SIGABRT), code -6 in tid 7061
- Java语法(四)JVM Spec (3) Structure
- android_14 线性布局2
- 架构师之路始于云栖大会
- Object C 入门(转)