Change the order in which the menus are shown in android studio

0

This is making me uphill, to see if you can help me with this problem, at least for me.
I have created a menu with these options:

public class SectionPagerAdapter extends FragmentPagerAdapter {

    public SectionPagerAdapter(FragmentManager fm) {

        super(fm);
    }

    @Override
    public Fragment getItem(int position) {

        switch (position) {
            case 0:
                return new menu1();
            case 1:
                return new menu2();
            case 2:
                return new menu3();
            case 3:
                return new menu4();
            case 4:
                return new menu5();
            case 5:
                return new menu6();
            case 6:
                return new menu7();
            case 7:
                return new menu8();
            case 8:
                return new menu9();
            case 9:
                return new menu10();
            case 10:
                return new menu11();
            default:
                return new menu1();
        }
    }

    @Override
    public int getCount() {

        return 11;
    }

    @Override
    public CharSequence getPageTitle(int position) {

        switch (position) {
            case 0:
                return "menu1";
            case 1:
                return "menu2";
            case 2:
                return "menu3";
            case 3:
                return "menu4";
            case 4:
                return "menu5";
            case 5:
                return "menu6";
            case 6:
                return "menu7";
            case 7:
                return "menu8";
            case 8:
                return "menu9";
            case 9:
                return "menu10";
            case 10:
                return "menu11";
            default:
                return "menu1";
        }
    }
}

And it shows the menu1 remains on the left side of the screen, how can I change the order, that it shows the menu1 but that in the menus it shows from right to left?

this is the code I have in activity_main.xml

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"/>

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


        </android.support.design.widget.TabLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>

Thank you.

    
asked by SoCu 07.12.2017 в 00:09
source

0 answers