Home > front end >  send tab layout on top
send tab layout on top

Time:05-25

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>

CodePudding user response:

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" />
  • Related