Android android:gravity属性介绍及效果图
2015-09-06 14:24
441 查看
IncTech开发者团队,承接App,微信,及其后台开发。更多精彩技术文章和技术研究,欢迎访问
我们的官网 http://www.inctech.cn
本文转载自/article/7842707.html
android:gravity="center" 表示一个view(TextView)里面的文本,按照这个布局来。 比如中心居中, 就用center,
水平居中就用 center_horizontal
垂直居中就用center_vertical
android:gravity的属性官方说明如下:
public static final intAXIS_CLIP
Since: API Level 3
Raw bit controlling whether the right/bottom edge is clipped to its container, based on the gravity direction being applied.
Constant Value: 8 (0x00000008)
public static final intAXIS_PULL_AFTER
Since: API Level 1
Raw bit controlling how the right/bottom edge is placed.
Constant Value: 4 (0x00000004)
public static final intAXIS_PULL_BEFORE
Since: API Level 1
Raw bit controlling how the left/top edge is placed.
Constant Value: 2 (0x00000002)
public static final intAXIS_SPECIFIED
Since: API Level 1
Raw bit indicating the gravity for an axis has been specified.
Constant Value: 1 (0x00000001)
public static final intAXIS_X_SHIFT
Since: API Level 1
Bits defining the horizontal axis.
Constant Value: 0 (0x00000000)
public static final intAXIS_Y_SHIFT
Since: API Level 1
Bits defining the vertical axis.
Constant Value: 4 (0x00000004)
public static final intBOTTOM
Since: API Level 1
Push object to the bottom of its container, not changing its size.
Constant Value: 80 (0x00000050)
public static final intCENTER
Since: API Level 1
Place the object in the center of its container in both the vertical and horizontal axis, not changing its size.
Constant Value: 17 (0x00000011)
public static final intCENTER_HORIZONTAL
Since: API Level 1
Place object in the horizontal center of its container, not changing its size.
Constant Value: 1 (0x00000001)
public static final intCENTER_VERTICAL
Since: API Level 1
Place object in the vertical center of its container, not changing its size.
Constant Value: 16 (0x00000010)
public static final intCLIP_HORIZONTAL
Since: API Level 3
Flag to clip the edges of the object to its container along the horizontal axis.
Constant Value: 8 (0x00000008)
public static final intCLIP_VERTICAL
Since: API Level 3
Flag to clip the edges of the object to its container along the vertical axis.
Constant Value: 128 (0x00000080)
public static final intDISPLAY_CLIP_HORIZONTAL
Since: API Level 3
Special constant to enable clipping to an overall display along the horizontal dimension. This is not applied by default by
Constant Value: 16777216 (0x01000000)
public static final intDISPLAY_CLIP_VERTICAL
Since: API Level 3
Special constant to enable clipping to an overall display along the vertical dimension. This is not applied by default by
Constant Value: 268435456 (0x10000000)
public static final intEND
Since: API Level 14
Push object to x-axis position at the end of its container, not changing its size.
Constant Value: 8388613 (0x00800005)
public static final intFILL
Since: API Level 1
Grow the horizontal and vertical size of the object if needed so it completely fills its container.
Constant Value: 119 (0x00000077)
public static final intFILL_HORIZONTAL
Since: API Level 1
Grow the horizontal size of the object if needed so it completely fills its container.
Constant Value: 7 (0x00000007)
public static final intFILL_VERTICAL
Since: API Level 1
Grow the vertical size of the object if needed so it completely fills its container.
Constant Value: 112 (0x00000070)
public static final intHORIZONTAL_GRAVITY_MASK
Since: API Level 1
Binary mask to get the absolute horizontal gravity of a gravity.
Constant Value: 7 (0x00000007)
public static final intLEFT
Since: API Level 1
Push object to the left of its container, not changing its size.
Constant Value: 3 (0x00000003)
public static final intNO_GRAVITY
Since: API Level 1
Constant indicating that no gravity has been set
Constant Value: 0 (0x00000000)
public static final intRELATIVE_HORIZONTAL_GRAVITY_MASK
Since: API Level 14
Binary mask for the horizontal gravity and script specific direction bit.
Constant Value: 8388615 (0x00800007)
public static final intRELATIVE_LAYOUT_DIRECTION
Since: API Level 14
Raw bit controlling whether the layout direction is relative or not (START/END instead of absolute LEFT/RIGHT).
Constant Value: 8388608 (0x00800000)
public static final intRIGHT
Since: API Level 1
Push object to the right of its container, not changing its size.
Constant Value: 5 (0x00000005)
public static final intSTART
Since: API Level 14
Push object to x-axis position at the start of its container, not changing its size.
Constant Value: 8388611 (0x00800003)
public static final intTOP
Since: API Level 1
Push object to the top of its container, not changing its size.
Constant Value: 48 (0x00000030)
public static final intVERTICAL_GRAVITY_MASK
Since: API Level 1
Binary mask to get the vertical gravity of a gravity.
Constant Value: 112 (0x00000070)
效果图1:
布局文件xml内容如下:
[html]
view plaincopyprint?
<?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">
<TextView android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="top"
android:gravity="top"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView02"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="bottom"
android:gravity="bottom"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView03"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="left"
android:gravity="left"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView04"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="right"
android:gravity="right"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView05"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="center_vertical"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView06"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="fill_vertical"
android:gravity="fill_vertical"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView07"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView08"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="fill_horizontal"
android:gravity="fill_horizontal"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView09"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="center"
android:gravity="center"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView10"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="fill"
android:gravity="fill"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView11"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="clip_vertical"
android:gravity="clip_vertical"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView12"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="clip_horizontal"
android:gravity="clip_horizontal"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
</LinearLayout>
效果图2:
xml布局文件如下:
[html]
view plaincopyprint?
<?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">
<TextView android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="top"
android:gravity="top"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView02"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="bottom"
android:gravity="bottom"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView03"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="left"
android:gravity="left"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView04"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="right"
android:gravity="right"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView05"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="center_vertical"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView06"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="fill_vertical"
android:gravity="fill_vertical"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView07"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView08"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="fill_horizontal"
android:gravity="fill_horizontal"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView09"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="center"
android:gravity="center"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView10"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="fill"
android:gravity="fill"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView11"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="clip_vertical"
android:gravity="clip_vertical"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView12"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="clip_horizontal"
android:gravity="clip_horizontal"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
</LinearLayout>
IncTech开发者团队,承接App,微信,及其后台开发。更多精彩技术文章和技术研究,欢迎访问
我们的官网 http://www.inctech.cn
我们的官网 http://www.inctech.cn
本文转载自/article/7842707.html
android:gravity="center" 表示一个view(TextView)里面的文本,按照这个布局来。 比如中心居中, 就用center,
水平居中就用 center_horizontal
垂直居中就用center_vertical
android:gravity的属性官方说明如下:
public static final intAXIS_CLIP
Since: API Level 3Raw bit controlling whether the right/bottom edge is clipped to its container, based on the gravity direction being applied.
Constant Value: 8 (0x00000008)
public static final intAXIS_PULL_AFTER
Since: API Level 1Raw bit controlling how the right/bottom edge is placed.
Constant Value: 4 (0x00000004)
public static final intAXIS_PULL_BEFORE
Since: API Level 1Raw bit controlling how the left/top edge is placed.
Constant Value: 2 (0x00000002)
public static final intAXIS_SPECIFIED
Since: API Level 1Raw bit indicating the gravity for an axis has been specified.
Constant Value: 1 (0x00000001)
public static final intAXIS_X_SHIFT
Since: API Level 1Bits defining the horizontal axis.
Constant Value: 0 (0x00000000)
public static final intAXIS_Y_SHIFT
Since: API Level 1Bits defining the vertical axis.
Constant Value: 4 (0x00000004)
public static final intBOTTOM
Since: API Level 1Push object to the bottom of its container, not changing its size.
Constant Value: 80 (0x00000050)
public static final intCENTER
Since: API Level 1Place the object in the center of its container in both the vertical and horizontal axis, not changing its size.
Constant Value: 17 (0x00000011)
public static final intCENTER_HORIZONTAL
Since: API Level 1Place object in the horizontal center of its container, not changing its size.
Constant Value: 1 (0x00000001)
public static final intCENTER_VERTICAL
Since: API Level 1Place object in the vertical center of its container, not changing its size.
Constant Value: 16 (0x00000010)
public static final intCLIP_HORIZONTAL
Since: API Level 3Flag to clip the edges of the object to its container along the horizontal axis.
Constant Value: 8 (0x00000008)
public static final intCLIP_VERTICAL
Since: API Level 3Flag to clip the edges of the object to its container along the vertical axis.
Constant Value: 128 (0x00000080)
public static final intDISPLAY_CLIP_HORIZONTAL
Since: API Level 3Special constant to enable clipping to an overall display along the horizontal dimension. This is not applied by default by
apply(int, int, int, Rect, int, int, Rect); you must do so yourself by calling
applyDisplay(int, Rect, Rect).
Constant Value: 16777216 (0x01000000)
public static final intDISPLAY_CLIP_VERTICAL
Since: API Level 3Special constant to enable clipping to an overall display along the vertical dimension. This is not applied by default by
apply(int, int, int, Rect, int, int, Rect); you must do so yourself by calling
applyDisplay(int, Rect, Rect).
Constant Value: 268435456 (0x10000000)
public static final intEND
Since: API Level 14Push object to x-axis position at the end of its container, not changing its size.
Constant Value: 8388613 (0x00800005)
public static final intFILL
Since: API Level 1Grow the horizontal and vertical size of the object if needed so it completely fills its container.
Constant Value: 119 (0x00000077)
public static final intFILL_HORIZONTAL
Since: API Level 1Grow the horizontal size of the object if needed so it completely fills its container.
Constant Value: 7 (0x00000007)
public static final intFILL_VERTICAL
Since: API Level 1Grow the vertical size of the object if needed so it completely fills its container.
Constant Value: 112 (0x00000070)
public static final intHORIZONTAL_GRAVITY_MASK
Since: API Level 1Binary mask to get the absolute horizontal gravity of a gravity.
Constant Value: 7 (0x00000007)
public static final intLEFT
Since: API Level 1Push object to the left of its container, not changing its size.
Constant Value: 3 (0x00000003)
public static final intNO_GRAVITY
Since: API Level 1Constant indicating that no gravity has been set
Constant Value: 0 (0x00000000)
public static final intRELATIVE_HORIZONTAL_GRAVITY_MASK
Since: API Level 14Binary mask for the horizontal gravity and script specific direction bit.
Constant Value: 8388615 (0x00800007)
public static final intRELATIVE_LAYOUT_DIRECTION
Since: API Level 14Raw bit controlling whether the layout direction is relative or not (START/END instead of absolute LEFT/RIGHT).
Constant Value: 8388608 (0x00800000)
public static final intRIGHT
Since: API Level 1Push object to the right of its container, not changing its size.
Constant Value: 5 (0x00000005)
public static final intSTART
Since: API Level 14Push object to x-axis position at the start of its container, not changing its size.
Constant Value: 8388611 (0x00800003)
public static final intTOP
Since: API Level 1Push object to the top of its container, not changing its size.
Constant Value: 48 (0x00000030)
public static final intVERTICAL_GRAVITY_MASK
Since: API Level 1Binary mask to get the vertical gravity of a gravity.
Constant Value: 112 (0x00000070)
效果图1:
布局文件xml内容如下:
[html]
view plaincopyprint?
<?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">
<TextView android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="top"
android:gravity="top"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView02"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="bottom"
android:gravity="bottom"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView03"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="left"
android:gravity="left"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView04"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="right"
android:gravity="right"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView05"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="center_vertical"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView06"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="fill_vertical"
android:gravity="fill_vertical"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView07"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView08"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="fill_horizontal"
android:gravity="fill_horizontal"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView09"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="center"
android:gravity="center"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView10"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="fill"
android:gravity="fill"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView11"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="clip_vertical"
android:gravity="clip_vertical"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
<TextView android:id="@+id/TextView12"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:text="clip_horizontal"
android:gravity="clip_horizontal"
android:textColor="#ffffff"
android:background="#ff0000"
android:layout_margin="1px"/>
</LinearLayout>
<?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"> <TextView android:id="@+id/TextView01" android:layout_width="fill_parent" android:layout_height="35dp" android:text="top" android:gravity="top" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView02" android:layout_width="fill_parent" android:layout_height="35dp" android:text="bottom" android:gravity="bottom" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView03" android:layout_width="fill_parent" android:layout_height="35dp" android:text="left" android:gravity="left" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView04" android:layout_width="fill_parent" android:layout_height="35dp" android:text="right" android:gravity="right" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView05" android:layout_width="fill_parent" android:layout_height="35dp" android:text="center_vertical" android:gravity="center_vertical" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView06" android:layout_width="fill_parent" android:layout_height="35dp" android:text="fill_vertical" android:gravity="fill_vertical" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView07" android:layout_width="fill_parent" android:layout_height="35dp" android:text="center_horizontal" android:gravity="center_horizontal" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView08" android:layout_width="fill_parent" android:layout_height="35dp" android:text="fill_horizontal" android:gravity="fill_horizontal" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView09" android:layout_width="fill_parent" android:layout_height="35dp" android:text="center" android:gravity="center" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView10" android:layout_width="fill_parent" android:layout_height="35dp" android:text="fill" android:gravity="fill" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView11" android:layout_width="fill_parent" android:layout_height="35dp" android:text="clip_vertical" android:gravity="clip_vertical" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> <TextView android:id="@+id/TextView12" android:layout_width="fill_parent" android:layout_height="35dp" android:text="clip_horizontal" android:gravity="clip_horizontal" android:textColor="#ffffff" android:background="#ff0000" android:layout_margin="1px"/> </LinearLayout>
效果图2:
xml布局文件如下:
[html]
view plaincopyprint?
<?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">
<TextView android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="top"
android:gravity="top"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView02"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="bottom"
android:gravity="bottom"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView03"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="left"
android:gravity="left"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView04"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="right"
android:gravity="right"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView05"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="center_vertical"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView06"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="fill_vertical"
android:gravity="fill_vertical"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView07"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView08"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="fill_horizontal"
android:gravity="fill_horizontal"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView09"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="center"
android:gravity="center"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView10"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="fill"
android:gravity="fill"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView11"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="clip_vertical"
android:gravity="clip_vertical"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
<TextView android:id="@+id/TextView12"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:text="clip_horizontal"
android:gravity="clip_horizontal"
android:textColor="#ffffff"
android:background="#00ff00"
android:layout_margin="2px"/>
</LinearLayout>
IncTech开发者团队,承接App,微信,及其后台开发。更多精彩技术文章和技术研究,欢迎访问
我们的官网 http://www.inctech.cn
<?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"> <TextView android:id="@+id/TextView01" android:layout_width="fill_parent" android:layout_height="50dp" android:text="top" android:gravity="top" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView02" android:layout_width="fill_parent" android:layout_height="50dp" android:text="bottom" android:gravity="bottom" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView03" android:layout_width="fill_parent" android:layout_height="50dp" android:text="left" android:gravity="left" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView04" android:layout_width="fill_parent" android:layout_height="50dp" android:text="right" android:gravity="right" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView05" android:layout_width="fill_parent" android:layout_height="50dp" android:text="center_vertical" android:gravity="center_vertical" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView06" android:layout_width="fill_parent" android:layout_height="50dp" android:text="fill_vertical" android:gravity="fill_vertical" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView07" android:layout_width="fill_parent" android:layout_height="50dp" android:text="center_horizontal" android:gravity="center_horizontal" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView08" android:layout_width="fill_parent" android:layout_height="50dp" android:text="fill_horizontal" android:gravity="fill_horizontal" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView09" android:layout_width="fill_parent" android:layout_height="50dp" android:text="center" android:gravity="center" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView10" android:layout_width="fill_parent" android:layout_height="50dp" android:text="fill" android:gravity="fill" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView11" android:layout_width="fill_parent" android:layout_height="50dp" android:text="clip_vertical" android:gravity="clip_vertical" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> <TextView android:id="@+id/TextView12" android:layout_width="fill_parent" android:layout_height="50dp" android:text="clip_horizontal" android:gravity="clip_horizontal" android:textColor="#ffffff" android:background="#00ff00" android:layout_margin="2px"/> </LinearLayout>
相关文章推荐
- 控件具体位置
- Android 去掉ListView/GridView下拉出空白回弹的效果,以及使用PullToRefresh出现的问题
- android:padding和android:margin的区别
- (android高仿系列)今日头条 --新闻阅读器 (三) 完结 、总结 篇
- Android 读书摘要
- smssdk导入AndroidStudio出现 com.android.dex.DexException: Multiple dex files define 解决方法
- Android activity动画调用方式
- Android IOS WebRTC 音视频开发总结(二二)-- multimeetingArchitecture
- Android中屏幕密度和图片大小的关系分析
- Android中ViewPager中界面的循环滑动
- Android属性动画完全解析(下),Interpolator和ViewPropertyAnimator的用法
- Android Spinner控件 显示数据和下拉选中数据分离
- Android属性动画完全解析(上),初识属性动画的基本用法
- Android Animation动画(很详细)
- 【Android基础】-View.MeasureSpec
- Android ListView详解(二)
- Android 反编译详细介绍
- android support 支持包 使用
- Android创建和删除快捷图标
- android横竖屏切换处理