檢查Action Bar Sherlock。安裝「ABS:Demos」應用程序並查找「Tab Navigation」示例並嘗試使用它。
UPDATE
哦,我知道了...
所以,儘量用 「ABS:碎片」 的應用程序。這裏有一個名爲「Tabs」的例子。
如果你看到它的佈局(fragment_tabs.xml),你可以看到每個部件。您可以將TabHost
換成新的LinearLayout
,然後在TabHost
之上加上View
。
更改此:
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TabWidget
android:id="@android:id/tabs"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<FrameLayout
android:id="@+android:id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
這樣的事情:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/Hello"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CHANGE ME FOR THE VIEW YOU WANT" />
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TabWidget
android:id="@android:id/tabs"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<FrameLayout
android:id="@+android:id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</TabHost>
泰快速的答案。我知道這個例子,它很容易實現。問題是我需要上面的標籤圖片標題和標籤需要向上滾動,直到他們到達頂部,然後堅持在那裏。 – MarkoMilos
添加了更新。 –
好吧,讓我說,我把標籤內容與一些項目列表視圖。我想要達到的目標是:當用戶滾動列表時,您命名爲「爲我所需的視圖改變我」的textView應該離開屏幕。當用戶一直向下滾動時,它應該回來。 – MarkoMilos