Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

send tab layout on top

I want my tab layout to appear on top of my screen. Currently it is on the bottom on the screen. Tried a few ways didn’t work. How can I make it go on top of my screen.

Code for the xml file

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".kanbanManagement">
    <LinearLayout 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:orientation="vertical">


        <androidx.viewpager2.widget.ViewPager2
            android:layout_width="match_parent"
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_height="0dp"
            android:id="@+id/viewPager2"
            android:layout_weight="1" />
        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            app:tabGravity="fill"
            app:tabIndicator="@drawable/tab_indicator"
            app:tabIndicatorAnimationMode="elastic"
            app:tabIndicatorGravity="stretch"
            app:tabMode="fixed"
            app:tabSelectedTextColor="@color/white" />
    </LinearLayout>
    <!-- TODO: Update blank fragment layout -->
    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="@string/hello_blank_fragment" />

</FrameLayout>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Hello just put the tabs tag on the top of view pager like this :

    <com.google.android.material.tabs.TabLayout
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        app:tabGravity="fill"
        app:tabIndicator="@drawable/add_signature_icon"
        app:tabIndicatorAnimationMode="elastic"
        app:tabIndicatorGravity="stretch"
        app:tabMode="fixed"
        app:tabSelectedTextColor="@color/white" />

    <androidx.viewpager2.widget.ViewPager2
        android:layout_width="match_parent"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="0dp"
        android:id="@+id/viewPager2"
        android:layout_weight="1" />
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading