rkovtiuk
rkovtiuk

Reputation: 32

ScrollView for TabLayout with VIewPager

I need to scroll the TabLayout, but when I write this code, the TabLayout is invisible.

How can I edit this code for the scrolling text in items of TabLayout?

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

<ScrollView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <android.support.v4.view.ViewPager
        android:id="@+id/book_viewpager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.design.widget.TabLayout
            android:id="@+id/book_tab_layout"
            app:tabGravity="fill"
            android:layout_height="wrap_content"
            android:layout_width="match_parent">

            <android.support.design.widget.TabItem
                android:id="@+id/book_description_tab_item"
                android:text="@string/book_description"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <android.support.design.widget.TabItem
                android:id="@+id/book_reviews_tab_item"
                android:text="@string/book_reviews"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <android.support.design.widget.TabItem
                android:id="@+id/book_related_titles_tab_item"
                android:text="@string/book_related_titles"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </android.support.design.widget.TabLayout>
    </android.support.v4.view.ViewPager>
</ScrollView>

Upvotes: 0

Views: 3669

Answers (1)

deepak4666
deepak4666

Reputation: 44

use android.support.v7.widget.NestedScrollView in place of ScrollView. with app:layout_behaviour="@string/appbar_scrolling_view_behavior"

Upvotes: 2

Related Questions