Forum Xamarin.Android

How to The direction of the tab slide changed bottom

monemdcmonemdc Member ✭✭✭

hi

I used the following example for the tab Fragment facing top.
I want to change the direction of the tab slide in the tab Fragment to bottom .

full example:-

https://drive.google.com/file/d/14AeMCfYk8KrcDWmbZNFwKt2YAnfUsYDs/view?usp=sharing

Tagged:

Best Answers

  • jezhjezh Xamurai
    Accepted Answer

    You can change the root element of your activity_main.xaml to LinearLayout, and add property android:orientation="vertical". Meanwhile add the following properties for your ViewPager.
    You can refer to the following code:

      <?xml version="1.0" encoding="utf-8"?>
    <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:orientation="vertical"
        android:layout_height="match_parent">
    
        <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
            <include
                layout="@layout/app_bar" />
        </android.support.design.widget.AppBarLayout>
        <android.support.v4.view.ViewPager
            android:id="@+id/viewpagerIcon"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    
        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
            <android.support.design.widget.TabLayout
                android:layout_alignParentBottom="true"
                android:id="@+id/sliding_tabsIcon"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabMode="fixed"
                app:tabGravity="fill" />
        </android.support.design.widget.AppBarLayout>
    
    </LinearLayout>
    

    The result is:

  • jezhjezh Xamurai
    Accepted Answer

    It's my pleasure to help you. Happy coding... :)

Answers

  • jezhjezh Member, Xamarin Team Xamurai
    Accepted Answer

    You can change the root element of your activity_main.xaml to LinearLayout, and add property android:orientation="vertical". Meanwhile add the following properties for your ViewPager.
    You can refer to the following code:

      <?xml version="1.0" encoding="utf-8"?>
    <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:orientation="vertical"
        android:layout_height="match_parent">
    
        <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
            <include
                layout="@layout/app_bar" />
        </android.support.design.widget.AppBarLayout>
        <android.support.v4.view.ViewPager
            android:id="@+id/viewpagerIcon"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    
        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
            <android.support.design.widget.TabLayout
                android:layout_alignParentBottom="true"
                android:id="@+id/sliding_tabsIcon"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabMode="fixed"
                app:tabGravity="fill" />
        </android.support.design.widget.AppBarLayout>
    
    </LinearLayout>
    

    The result is:

  • monemdcmonemdc Member ✭✭✭

    hi

    jezh

    All thanks and appreciation for your answer to my question.

  • jezhjezh Member, Xamarin Team Xamurai
    Accepted Answer

    It's my pleasure to help you. Happy coding... :)

Sign In or Register to comment.