astuetz / PagerSlidingTabStrip

An interactive indicator to navigate between the different pages of a ViewPager
139 stars 44 forks source link

Include PagerSlidingTabStrip within android.support.v7.widget.Toolbar #163

Open russellhoff opened 9 years ago

russellhoff commented 9 years ago

Can I include tabs (which are supposed to be in com.astuetz.PagerSlidingTabStrip) within the Toolbar when editing a layout?

What I want to do is the following:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res/com.ingartek.cavimpresoras">

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimaryDark" >

   <!-- style="@style/Widget.MyApp.ActionBar"> --> 

    <com.astuetz.PagerSlidingTabStrip
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="48dip"
        app:pstsShouldExpand="true" />

</android.support.v7.widget.Toolbar>

<android.support.v4.view.ViewPager 
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="0px"
    android:layout_weight="1"
    android:background="@android:color/white" />

But I get an error when inflating the layout, exactly in the Toolbar open tag. Can this be implemented somehow?

lucamenor commented 9 years ago

Why do you not use below the Toolbar? Between Toolbar and ViewPager