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

ディレクトリ 検索
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
テキスト


TabHost

翻譯時(shí)間:2010-11-25

版本:Android 2.3 r1

?

結(jié)構(gòu)

繼承關(guān)系

public class TabHost extends FrameLayout implements ViewTreeObserver.OnTouchModeChangeListener

????????

java.lang.Object

android.view.View

??????? android.view.ViewGroup

??????? ??????? android.widget.FrameLayout

??????? ??????? ??????? android.widget.TabHost

?

類概述

?????????????

提供選項(xiàng)卡(Tab頁(yè))的窗口視圖容器。此對(duì)象包含兩個(gè)子對(duì)象:一組是用戶可以選擇指定Tab頁(yè)的標(biāo)簽;另一組是FrameLayout用來(lái)顯示該Tab頁(yè)的內(nèi)容。個(gè)別元素通??刂剖褂眠@個(gè)容器對(duì)象,而不是設(shè)置在子元素本身的值。

(譯者注:即使使用的是單個(gè)元素,也最好把它放到容器對(duì)象ViewGroup里)

?

內(nèi)部類

interface TabHost.OnTabChangeListener????

接口定義了當(dāng)選項(xiàng)卡更改時(shí)被調(diào)用的回調(diào)函數(shù)

?

interface TabHost.TabContentFactory??

當(dāng)某一選項(xiàng)卡被選中時(shí)生成選項(xiàng)卡的內(nèi)容

?

class TabHost.TabSpec?????

單獨(dú)的選項(xiàng)卡,每個(gè)選項(xiàng)卡都有一個(gè)選項(xiàng)卡指示符,內(nèi)容和tag標(biāo)簽,以便于記錄.

?

公共方法

public void addTab (TabHost.TabSpec tabSpec)

新增一個(gè)選項(xiàng)卡

參數(shù)

tabSpec??? 指定怎樣創(chuàng)建指示符和內(nèi)容.

?

public void clearAllTabs ()

tab widget中移除所有關(guān)聯(lián)到當(dāng)前tab host的選項(xiàng)卡

?

public boolean dispatchKeyEvent (KeyEvent event)

分發(fā)按鍵事件到焦點(diǎn)傳遞路線上的下一視圖。焦點(diǎn)傳遞路線從視圖樹(shù)的頂層開(kāi)始一直到當(dāng)前獲取焦點(diǎn)的視圖停止。如果此視圖已經(jīng)獲取焦點(diǎn),將分發(fā)給它自身。否則,將分發(fā)到焦點(diǎn)傳遞路線的下一節(jié)點(diǎn)。此方法會(huì)觸發(fā)任何一個(gè)按鍵監(jiān)聽(tīng)器.

(譯者注:關(guān)于focus path,可以參考以下地址:

http://blog.csdn.net/maxleng/archive/2010/05/04/5557758.aspx)

參數(shù)

event??????? 分發(fā)的按鍵事件

返回值

如果事件已經(jīng)處理則返回true,否則返回false.

?

public void dispatchWindowFocusChanged (boolean hasFocus)

當(dāng)窗口包含的此視圖獲取或丟失焦點(diǎn)時(shí)觸發(fā)此方法.ViewGroups應(yīng)該重寫(xiě)以路由到他的子元素

參數(shù)

hasFocus 如果窗口包含的此view依獲取焦點(diǎn),返回true,否則返回false.

?

public int getCurrentTab ()

(譯者注:獲取當(dāng)前選項(xiàng)卡的id

?

public String getCurrentTabTag ()

(譯者注:當(dāng)前選項(xiàng)卡的Tag標(biāo)簽內(nèi)容)

?

public View getCurrentTabView ()

(譯者注:獲取當(dāng)前選項(xiàng)卡的視圖view

?

public View getCurrentView ()

(譯者注:獲取當(dāng)前的視圖view

?

public FrameLayout getTabContentView ()

獲取保存tab內(nèi)容的FrameLayout

?

public TabWidget getTabWidget ()

(譯者注:根據(jù)系統(tǒng)規(guī)定的idtabs來(lái)找到TabWidget,并返回,注意,這里的ID必須是tabs。源代碼中表示如下:

private TabWidget mTabWidget;

mTabWidget=(TabWidget)findViewById(com.android.internal.R.id.tabs);

?

public TabHost.TabSpec newTabSpec (String tag)

獲取一個(gè)新的TabHost.TabSpec,并關(guān)聯(lián)到當(dāng)前tab host

參數(shù)

tag?? 所需的選項(xiàng)卡標(biāo)簽(tag)

?

public void onTouchModeChanged (boolean isInTouchMode)

當(dāng)觸摸模式發(fā)生改變時(shí)調(diào)用的回調(diào)函數(shù).

參數(shù)

isInTouchMode???????? 如果視圖結(jié)構(gòu)當(dāng)前處于觸摸模式,返回true,否則返回false.

?

public void setCurrentTab (int index)

(譯者注:設(shè)置當(dāng)前的選項(xiàng)卡

參數(shù)

Index??????? 為當(dāng)前選項(xiàng)卡的索引。)

?

public void setCurrentTabByTag (String tag)

(譯者注:根據(jù)選項(xiàng)卡的Tab標(biāo)簽來(lái)設(shè)置當(dāng)前的選項(xiàng)卡

??????????????????????????? 參數(shù)

tag? 想要被設(shè)置為當(dāng)前選項(xiàng)卡的tag標(biāo)簽值。)

?

public void setOnTabChangedListener (TabHost.OnTabChangeListener l)

注冊(cè)一個(gè)回調(diào)函數(shù),當(dāng)選項(xiàng)卡中的任何一個(gè)tab的選中狀態(tài)發(fā)生改變時(shí)調(diào)用。

(譯者注:setCurrentTab(index)時(shí)會(huì)觸發(fā)調(diào)用)

參數(shù)

l??????? 將運(yùn)行的回調(diào)函數(shù)

????????

public void setup ()

如果使用findViewById()加載TabHost,那么在新增一個(gè)選項(xiàng)卡tab之前,需要調(diào)用setup()。然而,當(dāng)你在一個(gè)TabActivity里使用getTabHost()獲取TabHost,你就不再需要調(diào)用setup()了。(譯者注:實(shí)現(xiàn)tab窗口的兩種方法:繼承activity時(shí),使用findViewById()查找TabHost,然后調(diào)用setup();繼承TabActivity,通過(guò)getTabHost()查找,此時(shí)不用調(diào)用setup())例子:

?

public void setup (LocalActivityManager activityGroup)

如果你使用setContent(android.content.Intent),那么當(dāng)activityGroup用于加載本地activity之時(shí),必須調(diào)用此方法。如果你拓展(繼承)TabActivity將自動(dòng)調(diào)用setup()方法。

參數(shù)

activityGroup?? 用來(lái)為選項(xiàng)卡內(nèi)容加載activitiesativityGroup

?

受保護(hù)方法

protected void onAttachedToWindow ()

當(dāng)視圖附加到窗口上時(shí)被調(diào)用。在這個(gè)點(diǎn)的表面進(jìn)行繪制。注意此函數(shù)確保在onDraw(Cancas)之前調(diào)用,然而它可能在第一次執(zhí)行onDraw之前的任何時(shí)間被調(diào)用——包括的onMeasure(int,int)的之前或之后。

?

protected void onDetachedFromWindow ()

當(dāng)視圖從窗口分離時(shí)被調(diào)用。在這個(gè)點(diǎn)的表面不再有畫(huà)面繪制。

?

補(bǔ)充

文章鏈接

???????? 史上最全的AndroidTabTabHost講解

???????? Android UI設(shè)計(jì) Tab TabHost標(biāo)簽頁(yè)的使用

???????? Android 控件之TabHost Tab頁(yè)

動(dòng)態(tài)Tab頁(yè)

示例代碼

???????? Java

public class Tabs1 extends TabActivity {

?

??? @Override

??? protected void onCreate(Bundle savedInstanceState) {

??????? super.onCreate(savedInstanceState);

??????? TabHost tabHost = getTabHost();

???????

??????? LayoutInflater.from(this).inflate(R.layout.tabs1, tabHost.getTabContentView(), true);

?

??????? tabHost.addTab(tabHost.newTabSpec("tab1")

??????????????? .setIndicator("tab1")

??????????????? .setContent(R.id.view1));

??????? tabHost.addTab(tabHost.newTabSpec("tab3")

??????????????? .setIndicator("tab2")

??????????????? .setContent(R.id.view2));

??????? tabHost.addTab(tabHost.newTabSpec("tab3")

??????????????? .setIndicator("tab3")

??????????????? .setContent(R.id.view3));

??? }

}

????????

???????? XML

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

?

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

??? android:layout_width="match_parent"

??? android:layout_height="match_parent">

?

??? <TextView android:id="@+id/view1"

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

??????? android:layout_width="match_parent"

??????? android:layout_height="match_parent"

??????? android:text="@string/tabs_1_tab_1"/>

??? <TextView android:id="@+id/view2"

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

??????? android:layout_width="match_parent"

??????? android:layout_height="match_parent"

??????? android:text="@string/tabs_1_tab_2"/>

??? <TextView android:id="@+id/view3"

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

??????? android:layout_width="match_parent"

??????? android:layout_height="match_parent"

??????? android:text="@string/tabs_1_tab_3"/>

</FrameLayout>

詳細(xì)參見(jiàn)apidemo/view/tabs1


前の記事: 次の記事: