0

I'm really new to Android and I just created a new Tabbed Activity from the gallery of Android Studio.

enter image description here

Now i want to add a Button "Next" in the first screen that automatically slide to the second View of the Tabbed Activity.

This is my code for now:

.... //The default stuff created from Android Studio

Button b1;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

       final View rootView = inflater.inflate(R.layout.fragment_main, container, false);
       b1 = (Button) rootView.findViewById(R.id.b_next1);

        if(getArguments().getInt(ARG_SECTION_NUMBER)==1) {

            b1.setOnClickListener(new View.OnClickListener()
            {
                public void onClick(View V)
                {
                    //HERE I NEED TO SLIDE MY VIEW FROM THE FIRST TO THE SECOND ONE
                }
            });
        }

        if(getArguments().getInt(ARG_SECTION_NUMBER)==2) {

        }

        if(getArguments().getInt(ARG_SECTION_NUMBER)==3) {

        }
}

.... //The default stuff created from Android Studio

I need the simplest solution, i don't want add new fragments.

I just want add this button for slide the view using only the default code given from android. Is possible? Thanks

p.s. All the other code that i have is the code created automatically from android studio for a tabbed activity.

GMX
  • 950
  • 1
  • 14
  • 29

1 Answers1

0

A pageTransformer could do the job, you can find the specifics here: https://developer.android.com/reference/android/support/v4/view/ViewPager.PageTransformer.html

This post also might help: How to Implement PageTransformer with Swipeable Tabs

NyW
  • 107
  • 8