Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swipe Horizontal

I need to swipe horizontally between list of questions and their respective choices in a radio group. I have read that I have different choices such as: 1- Gesture Detector 2- ViewPage 3- ViewPage with fragments

I have tried ViewPage but I am facing different problems on how to swipe backward and indicating which choice has been checked by the user. I need to use the easiest way to swipe forward and backward (indicating which choice has been checked)

I want to depend on Andriod methods as much as possible without storing the checked choices for example by myself since I believe that it is more optimized such methods from both run-time or code size. Please if there are other classes that I can use, guide me on that or which of them is really the best to perform my target

like image 297
Wael Showair Avatar asked Mar 05 '26 18:03

Wael Showair


1 Answers

I would use ViewPager with a FragmentPagerAdapter. The items of the adapter would be different instances of the same fragment. Each fragment would contain a static question text and a radio group of possible answers to the question. ViewPager then will take care of swiping substituting one such fragment with another.

like image 188
Alexander Kulyakhtin Avatar answered Mar 08 '26 20:03

Alexander Kulyakhtin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!