亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

direktori cari
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
watak


RelativeLayout

版本:Android 2.3 r1

?

結(jié)構(gòu)

繼承關(guān)系

public class RelativeLayout extends ViewGroup

????????

java.lang.Object

android.view.View

android.view.ViewGroup

???????? android.widget.RelativeLayout

?

子類及間接子類

直接子類

???????? ???????? DialerFilter, TwoLineListItem

?

類概述

RelativeLayout顧名思義,相對(duì)布局,在這個(gè)容器內(nèi)部的子元素們可以使用彼此之間的相對(duì)位置或者和容器間的相對(duì)位置來進(jìn)行定位。

注意,不能在RelativeLayout容器本身和他的子元素之間產(chǎn)生循環(huán)依賴,比如說,不能將RelativeLayout的高設(shè)置成為WRAP_CONTENT的時(shí)候?qū)⒆釉氐母咴O(shè)置成為 ALIGN_PARENT_BOTTOM

(譯者注:這點(diǎn)額外要注意,當(dāng)然這也很好理解,如果容器是不定高的,那么子元素當(dāng)然無法對(duì)齊容器的底邊^_^)。

可以參考官方SDK中的 RelativeLayout教學(xué)貼Relative Layout tutorial

?

常量

數(shù)據(jù)類型

常量名稱

描述

int

ABOVE

定義將元素的底邊對(duì)齊另一個(gè)元素的頂邊

int

ALIGN_BASELINE

定義將元素基線的對(duì)齊另一個(gè)元素的基線

int

ALIGN_BOTTOM

定義將元素底邊的對(duì)齊另一個(gè)元素的底邊

int

ALIGN_LEFT

定義將元素的左邊對(duì)齊另一個(gè)元素的左邊

int

ALIGN_PARENT_BOTTOM

定義將元素的底邊對(duì)齊其父容器(RelativeLayout)的底邊

int

ALIGN_PARENT_LEFT

定義將元素的左邊對(duì)齊其父容器(RelativeLayout)的左邊

int

ALIGN_PARENT_RIGHT

定義將元素的右邊對(duì)齊其父容器(RelativeLayout)的右邊

int

ALIGN_PARENT_TOP

定義將元素的頂邊對(duì)齊其父容器(RelativeLayout)的頂邊

int

ALIGN_RIGHT

定義將元素的右邊對(duì)齊另一個(gè)元素的右邊

int

ALIGN_TOP

定義將元素的頂邊對(duì)齊另一個(gè)元素的頂邊

int

BELOW

定義將元素的頂邊對(duì)齊另一個(gè)元素的底邊

int

CENTER_HORIZONTAL

定義讓元素在容器(RelativeLayout)內(nèi)水平居中

int

CENTER_IN_PARENT

定義讓元素位于容器(RelativeLayout)的中心

int

CENTER_VERTICAL

定義讓元素在容器(RelativeLayout)內(nèi)垂直居中

int

LEFT_OF

定義將元素的右邊對(duì)齊另一個(gè)元素的左邊

int

RIGHT_OF

定義將元素的左邊對(duì)齊另一個(gè)元素的右邊

int

TRUE

?

?

內(nèi)部類

Class ????? RelativeLayout.LayoutParams ???

RelativeLayout相關(guān)聯(lián)的布局信息.

?

XML屬性

屬性名稱

描述

android:gravity

設(shè)置容器中的內(nèi)容該如何定位。對(duì)象本身的xy軸。

android:ignoreGravity

設(shè)置容器中的哪個(gè)子元素會(huì)不受Gravity的影響.

(譯者注:接收參數(shù):子元素的Id,如果設(shè)置成為0,則全部子元素都會(huì)受到影響)

?

公共方法

public boolean dispatchPopulateAccessibilityEvent (AccessibilityEvent event)

????????  分發(fā) AccessibilityEvent 事件到該 View 的子視圖中。

參數(shù)

??????????????????????????? event ????? 事件本身.

?????????????????? 返回值

??????????????????????????? 如果事件分發(fā)完成,返回真。

?

public RelativeLayout.LayoutParams generateLayoutParams (AttributeSet attrs)

返回一個(gè)新的已設(shè)置屬性集合的布局參數(shù)。

參數(shù)

??????????????????????????? attrs ?????? 構(gòu)建layout布局參數(shù)的屬性集合.

?????????????????? 返回值

??????????????????????????? 一個(gè)RelativeLayout.LayoutParams的實(shí)例或者他的一個(gè)子類

?

public int getBaseline ()

???????? 返回窗口空間的文本基準(zhǔn)線到其頂邊界的偏移量。如果這個(gè)部件不支持基準(zhǔn)線對(duì)齊,這個(gè)方法返回-1

?????????????????? 返回值

??????????????????????????? 基準(zhǔn)線的偏移量,如果不支持基準(zhǔn)線對(duì)齊則返回-1

?

public void requestLayout ()

???????? 當(dāng)容器中的某個(gè)視圖發(fā)生改變,會(huì)影響整個(gè)布局時(shí),就調(diào)用這個(gè)方法,他會(huì)改變整個(gè)視圖樹的布局。

?

public void setGravity (int gravity)

???????? 描述子視圖該如何擺放,默認(rèn)值是Gravity.LEFT | Gravity.TOP(譯者注:說明RelativeLayout的元素如果不設(shè)置位置,會(huì)從左上角開始堆疊)。

參數(shù)

??????????????????????????? gravity ?? 位置值,可以參考Gravity

?????????????????? 相關(guān)的XML屬性

??????????????????????????? android:gravity

?????????????????? 參見

??????????????????????????? setHorizontalGravity(int)

setVerticalGravity(int)

?

public void setHorizontalGravity (int horizontalGravity)

?

public void setVerticalGravity (int verticalGravity))

?

public void setIgnoreGravity (int viewId)

???????? 定義容器中的那個(gè)VIew會(huì)忽略容器設(shè)置的Gravity,如果容器設(shè)置的GravityGravity.LEFT | Gravity.TOP時(shí),定義這個(gè)屬性沒有任何效果。

參數(shù)

??????????????????????????? viewId????? 將要忽略容器Gravity的視圖的id,設(shè)置為0則不會(huì)有任何View忽略Gravity.

?????????????????? 相關(guān)的XML屬性

??????????????????????????? android:ignoreGravity

?????????????????? 參見

??????????????????????????? setGravity(int)

?

受保護(hù)方法

protected boolean checkLayoutParams (ViewGroup.LayoutParams p)

???????? (譯者注:檢測(cè)是不是AbsoluteLayout.LayoutParams的實(shí)例)?????

?

protected ViewGroup.LayoutParams ?generateDefaultLayoutParams ()

???????? 返回一組寬度為WRAP_CONTENT,高度為WRAP_CONTENT,坐標(biāo)是(0,0)的布局參數(shù)。

?????????????????? 返回值

??????????????????????????? 一組默認(rèn)的布局參數(shù)或null值。

?

protected ViewGroup.LayoutParams generateDefaultLayoutParams ( ViewGroup .LayoutParams p)

???????? 返回一組合法的受支持的布局參數(shù)。當(dāng)一個(gè)ViewGroup傳遞一個(gè)布局參數(shù)沒有通過checkLayoutParams(android.view.ViewGroup.LayoutParams)檢測(cè)的視圖時(shí),此方法被調(diào)用。此方法會(huì)返回一組新的適合當(dāng)前ViewGroup的布局參數(shù),可能從指定的一組布局參數(shù)中復(fù)制適當(dāng)?shù)膶傩浴?/span>

參數(shù)

??????????????????????????? p ???? 被轉(zhuǎn)換成一組適合當(dāng)前 ViewGroup的布局參數(shù).

?????????????????? 返回值

??????????????????????????? 一個(gè)ViewGroup.LayoutParams的實(shí)例或者其中的一個(gè)子節(jié)點(diǎn)

?

protected void onLayout (boolean changed, int l, int t, int r, int b)

???????? 在此視圖view給他的每一個(gè)子元素分配大小和位置時(shí)調(diào)用。 派生類可以重寫此方法并且重新安排他們子類的布局。

參數(shù)

??????????????????????????? changed?? 這是當(dāng)前視圖view的一個(gè)新的大小或位置

l??????? 相對(duì)于父節(jié)點(diǎn)的左邊位置

t??????? 相對(duì)于父節(jié)點(diǎn)的頂點(diǎn)位置

r??????? 相對(duì)于父節(jié)點(diǎn)的右邊位置

b?????? 相對(duì)于父節(jié)點(diǎn)的底部位置

?

public void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

???????? 測(cè)量視圖以確定其內(nèi)容寬度和高度。此方法被measure(int, int)調(diào)用。需要被子類重寫以提供對(duì)其內(nèi)容準(zhǔn)確高效的測(cè)量。

約定:當(dāng)重寫此方法時(shí),你必須調(diào)用setMeasuredDimension(int, int)來保存當(dāng)前視圖view的寬度和高度。不成功調(diào)用此方法將會(huì)導(dǎo)致一個(gè)IllegalStateException異常,是由measure(int, int)拋出。所以調(diào)用父類的onMeasure(int, int)方法是必須的。

父類的實(shí)現(xiàn)是以背景大小為默認(rèn)大小,除非MeasureSpec(測(cè)量細(xì)則)允許更大的背景。子類可以重寫onMeasure(int,int)以對(duì)其內(nèi)容提供更佳的尺寸。

如果此方法被重寫,那么子類的責(zé)任是確認(rèn)測(cè)量高度和測(cè)量寬度要大于視圖view的最小寬度和最小高度(getSuggestedMinimumHeight() and getSuggestedMinimumWidth()),使用這兩個(gè)方法可以取得最小寬度和最小高度。

參數(shù)

??????????????????????????? widthMeasureSpec ???????? 強(qiáng)加于父節(jié)點(diǎn)的橫向空間要求。要求是使用View.MeasureSpec進(jìn)行編碼。

??????????????????????????? heightMeasureSpec???????? 強(qiáng)加于父節(jié)點(diǎn)的縱向空間要求。要求是使用View.MeasureSpec進(jìn)行編碼。

?

補(bǔ)充

文章精選

???????? [Android學(xué)習(xí)指南] 相對(duì)布局 RelativeLayout

???????? Android RelativeLayout 屬性

???????? ?RelativeLayout 排版 _ 免寫程式 [blogspot]

示例代碼

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

??? android:layout_width="fill_parent"

??? android:layout_height="fill_parent">

??? <TextView

??????? android:id="@+id/label"

??????? android:layout_width="fill_parent"

??????? android:layout_height="wrap_content"

??????? android:text="Type here:"/>

??? <EditText

??????? android:id="@+id/entry"

??????? android:layout_width="fill_parent"

??????? android:layout_height="wrap_content"

??????? android:background="@android:drawable/editbox_background"

??????? android:layout_below="@id/label"/>

??? <Button

??????? android:id="@+id/ok"

??????? android:layout_width="wrap_content"

??????? android:layout_height="wrap_content"

??????? android:layout_below="@id/entry"

??????? android:layout_alignParentRight="true"

??????? android:layout_marginLeft="10dip"

??????? android:text="OK" />

??? <Button

????? ??android:layout_width="wrap_content"

??????? android:layout_height="wrap_content"

??????? android:layout_toLeftOf="@id/ok"

??????? android:layout_alignTop="@id/ok"

??????? android:text="Cancel" />

</RelativeLayout>


Artikel sebelumnya: Artikel seterusnya: