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.
PHP中文网2017-05-16 13:35:43
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?
仅有的幸福2017-05-16 13:35:43
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