?
This document uses PHP Chinese website manual Release
AbsoluteLayout.LayoutParams
版本:Android 2.2 r1
?
public static class AbsoluteLayout.LayoutParams extends ViewGroup.LayoutParams
?
java.lang.Object
android.view.ViewGroup.LayoutParams
??? ??? android.widget.AbsoluteLayout.LayoutParams
?
類概述
每個(gè)子元素布局信息與絕對布局相關(guān)聯(lián)。參見絕對布局屬性中該類所支持的子視圖屬性列表。(譯者注: AbsoluteLayout 的這種“絕對”定位的布局方式和我們非常熟悉的 Windows 編程中的 Left 和Top設(shè)置UI元素的位置是基本一致的。)
?
字段
???????? public int x
???????? 在View Group內(nèi)部子元素中的X水平位置。
?
???????? public int y
???????? 在View Group內(nèi)部子元素中的Y垂直位置。
?
構(gòu)造函數(shù)
???????? public AbsoluteLayout.LayoutParams(int width, int height, int x, int y)
創(chuàng)建一個(gè)新的具有指定寬度、高度和位置的布局參數(shù)。
參數(shù):
width ????? MATCH_PARENT
,
WRAP_CONTENT
或者固定大小的像素
height ??? MATCH_PARENT
,
WRAP_CONTENT
或者固定大小的像素
x ???? 子元素的X位置
y ???? 子元素的Y位置
?
public AbsoluteLayout.LayoutParams(Context c, AttributeSet attrs)
創(chuàng)建一組新的布局參數(shù),通過上下文提取的相關(guān)屬性值設(shè)置。XML屬性映射到這個(gè)布局參數(shù)設(shè)置如下:
·????????
layout_x
: 子元素的X位置
·????????
layout_y
: 子元素的Y位置
·????????
所有來自ViewGroup.LayoutParams的XML屬性
參數(shù):
c 上下文環(huán)境.
attrs ?????? 從屬性設(shè)置中提取布局參數(shù)值。
?
public AbsoluteLayout.LayoutParams(ViewGroup.LayoutParams source)
(譯者注:根據(jù)ViewGroup.LayoutParams實(shí)例化布局參數(shù),從源碼可以看出:
?
公共方法
???????? public String ?debug (String output)
返回設(shè)置的布局參數(shù)的字符串表示形式。
參數(shù)
output 用于內(nèi)部表示的預(yù)置字符串
返回值
返回如下格式字符串:輸出 + "ViewGroup.LayoutParams={ width=WIDTH, height=HEIGHT }"
?