Value |
Description |
top |
Put the object at the top of its container, not changing its size.
将对象放在其容器的顶部,不改变其大小. |
bottom |
Put the object at the bottom of its container, not changing its size.
将对象放在其容器的底部,不改变其大小. |
left |
Put the object at the left edge of its container, not changing its size.
将对象放在其容器的左侧,不改变其大小. |
right |
Put the object at the right edge of its container, not changing its size.
将对象放在其容器的右侧,不改变其大小. |
center_vertical |
Place object in the vertical center of its container, not changing its size.
将对象纵向居中,不改变其大小.
垂直对齐方式:垂直方向上居中对齐。 |
fill_vertical |
Grow the vertical size of the object if needed so it completely fills its container.
必要的时候增加对象的纵向大小,以完全充满其容器.
垂直方向填充 |
center_horizontal |
Place object in the horizontal center of its container, not changing its size.
将对象横向居中,不改变其大小.
水平对齐方式:水平方向上居中对齐 |
fill_horizontal |
Grow the horizontal size of the object if needed so it completely fills its container.
必要的时候增加对象的横向大小,以完全充满其容器.
水平方向填充 |
center |
Place the object in the center of its container in both the vertical and horizontal axis, not changing its size.
将对象横纵居中,不改变其大小. |
fill |
Grow the horizontal and vertical size of the object if needed so it completely fills its container. This is the default.
必要的时候增加对象的横纵向大小,以完全充满其容器. |
clip_vertical |
Additional option that can be set to have the top and/or bottom edges of the child clipped to its container's bounds. The clip is based on the vertical gravity: a top gravity clips the bottom edge, a bottom gravity clips the top edge, and neither clips both
edges.
附加选项,用于按照容器的边来剪切对象的顶部和/或底部的内容. 剪切基于其纵向对齐设置:顶部对齐时,剪切底部;底部对齐时剪切顶部;除此之外剪切顶部和底部.
垂直方向裁剪
|
clip_horizontal |
Additional option that can be set to have the left and/or right edges of the child clipped to its container's bounds. The clip is based on the horizontal gravity: a left gravity clips the right edge, a right gravity clips the left edge, and neither clips both
edges.
附加选项,用于按照容器的边来剪切对象的左侧和/或右侧的内容. 剪切基于其横向对齐设置:左侧对齐时,剪切右侧;右侧对齐时剪切左侧;除此之外剪切左侧和右侧.
水平方向裁剪
|
相关推荐
Android shape属性详解
android:gravity: 这个是针对控件里的元素来说的,用来控制元素在该控件里的显示位置。例如,在一个Button按钮控件中设置如下两个属性, android:gravity=”left”和android:text=”提交”,这时Button上的文字...
android:gravity 属性详细解读 重点有left/start 和right/end clip_vertical/clip_horizontal
《Android高薪之路:Android程序员面试宝典》目录: 第1章 Android入门 1 1 关于Android的非技术问题 1 1 1 为什么看好 Android 1 1 2 以前是否从事过Android的工作 做过哪些工作 1 1 3 你做的最复杂的界面是什么 1 ...
gravity:控制组件所包含的子元素的对齐方式,可多个组合。如(left | button) layout_gravity:控制该组件在父元素里的对齐方式。 开始使用studio实验吧: 1.给布局使用gravity属性: 效果图: 正常显示。 ...
android:layout_gravity 属性详细解读
android:gravity:设置的是控件自身上面的内容位置 android:layout_gravity:设置控件本身相对于父控件的...LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”ver
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center" > <RelativeLayout xmlns:...
LinearLayout是线性布局控件:要么横向排布,要么竖向排布 常用属性: ...android:gravity 属性是对该view中内容的限定.比如一个button 上面的text. 你可以设置该text 相对于view的靠左,靠右等位置. a
Android 开发 (实验五) 实验题目:Android 组件布局试验 指导老师: 班 级:计算机科学与技术系班 姓 名: 一、实验目的 1、掌握 Android 组件布局的使用方法 2、学会组件布局的重要属性与应用 3、能够根据需求,...
Android布局文件的属性值解析说明: 1 android:id [为控件指定相应的ID] 2 android:text [指定控件当中显示的文字 需要注意的是 这里尽量使用strings xml文件当中的字符串] 3 android:gravity [指定View组件的对齐...
layout_gravity 在 线性布局 和 帧布局 中的应用 通过代码 直观的展示 layout_gravity 和 gravity 的区别
1,android:orientation 布局方向。horizontal是让所有的子元素按水平方向从左到右... 例如: 下面这里的linearlayout的android:gravity设为right,有两个子元素Button01和Button02。 java代码: 代码如下: <?xml
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 4 android:layout_width="fill_parent" 5 android:layout_height="fill_parent" 6 android:id="@+...
android:textAlign="center"//EditText没有这个属性,但TextView有,居中 android:textColorHighlight="#cccccc"//被选中文字的底色,默认为蓝色 android:textColorHint="#ffff00"//设置提示信息文字的颜色,默认为...
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" ...
LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:gravity=center android:background=#000000 android:layout_width=fill_parent android:...
Android中gravity与layout_gravity的区别