动作条的标签就像在雅虎邮件应用程序就像、雅虎、应用程序、邮件

由网友(kiss丿你不懂)分享简介:我在Android的初学者。我的问题是如何创建动作条的标签,如雅虎邮件?采取以下I'm a beginner in Android. My question is how to create ActionBar tabs like yahoo mail?Take a look at the image below推...

我在Android的初学者。我的问题是如何创建动作条的标签,如雅虎邮件? 采取以下

I'm a beginner in Android. My question is how to create ActionBar tabs like yahoo mail? Take a look at the image below

推荐答案

使用 https://github.com/astuetz / PagerSlidingTabStrip 你可以把标签上的工具栏。

Using https://github.com/astuetz/PagerSlidingTabStrip you can put the tabs over the toolbar.

<?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>

阅读全文

相关推荐

最新文章