在某些布局之间添加滚动选项卡

时间:2014-10-27 11:41:00

标签: android

我想在xml文件中添加可滚动选项卡。通常我可以像

一样添加它
<android.support.v4.view.ViewPager 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.scrollabletab.MainActivity" />

它看起来像: enter image description here

但现在我想在视图中心添加此滚动选项卡。中心意味着在此滚动标签上方,我有应用徽标,一些包含不同文本视图的布局。我还想在这个滚动标签下面添加一些布局,这些布局再次包含不同的文本视图和布局。

怎么做?

enter image description here

2 个答案:

答案 0 :(得分:0)

您可以试用这个小部件:http://viewpagerindicator.com/

但常见的答案是:使用带标签的Actionbar: http://developer.android.com/guide/topics/ui/actionbar.html#Tabs

答案 1 :(得分:0)

为什么不在用于寻呼机的布局中使用ScrollView?