我是Android的初学者。我的问题是如何创建像雅虎邮件一样的ActionBar标签?
请看下面的图像
答案 0 :(得分:0)
使用https://github.com/astuetz/PagerSlidingTabStrip,您可以将标签放在工具栏上。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primary"
android:minHeight="56dp"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark"/>
<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_alignParentRight="true"
android:background="@color/primary"
app:pstsActivateTextColor="@color/white"
app:pstsDeactivateTextColor="#66323232"
app:pstsDividerColor="@color/primary"
app:pstsIndicatorColor="@color/white"
app:pstsIndicatorHeight="2dp"
app:pstsShouldExpand="true"
app:pstsTabSwitch="true"
app:pstsUnderlineHeight="0dp"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tabs"/>
</RelativeLayout>