user8030578
user8030578

Reputation:

How do i stop my TabLayout from stripping my other view

(http://imgur.com/Gx7nFdQ)

How do i stop this from happening ?,i have a view pager on top of tab layout,and basically im using a fragment (Please check the image link attached above)

<RelativeLayout
    android:id="@+id/root1"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >



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

    <android.support.design.widget.TabLayout
        android:id="@+id/tabLayout"
        app:tabMode="fixed"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:elevation="6dp"
        app:tabTextColor="@android:color/darker_gray"
        app:tabBackground="@android:color/white"
        app:tabSelectedTextColor="#ff00ff"
        app:tabIndicatorColor="#ff00ff"
        android:minHeight="?attr/actionBarSize"
        android:layout_alignParentBottom="true"
        />

</RelativeLayout>

Should i use a NestedScrollView instead of a relative layout,would that help ??

Any help would be deeply appreciated

Upvotes: 1

Views: 71

Answers (2)

Muhammad Saad Rafique
Muhammad Saad Rafique

Reputation: 3189

<android.support.design.widget.TabLayout
        android:id="@+id/tabLayout"
        android:layout_below="@+id/simpleViewPager"
        app:tabMode="fixed"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="10dp"
        android:elevation="6dp"
        app:tabTextColor="@android:color/darker_gray"
        app:tabBackground="@android:color/white"
        app:tabSelectedTextColor="#ff00ff"
        app:tabIndicatorColor="#ff00ff"
        android:minHeight="?attr/actionBarSize"
        android:layout_alignParentBottom="true"
        />

Upvotes: 0

Veneet Reddy
Veneet Reddy

Reputation: 2927

Add android:layout_above="@+id/tabLayout" on the ViewPager and remove + from id declaration of tabLayout: android:id="@id/tabLayout"

Upvotes: 1

Related Questions