java - Implement a button on both sides. Click the button to switch the content in the middle. The middle can be a fragment. How to achieve this effect?
習慣沉默
習慣沉默 2017-05-16 13:33:43
0
2
831

Implement a button on both sides. Click the button to switch the content in the middle. The middle can be a fragment. How to achieve this effect? ​​
I have tried viewpager, but it is not easy to use in the project , please find other solutions.

習慣沉默
習慣沉默

reply all(2)
洪涛

Why don’t you use a list to save your fragment? Click the left and right buttons to perform the corresponding list.get(position) addition and subtraction operations, and then replace the fragment. Is this enough to meet your needs?

仅有的幸福

This is very simple.

To display a fragment, click the button to show it directly, or replace the current fragment

getSupportFragmentManager().beginTransaction()
                .replace(R.id.container, fragmentA)
                .commit();

Button can use RadioGroup to nest RadioButton

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template