检查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