How to generate Fragments automatically?

Asked

Viewed 39 times

0

Hello, I am developing a project where the user will create questions in the backend, and I will have to receive them through an API, generating them one per screen on android. What I need to know is if I can create Fragments dynamically, since each user can generate different numbers of questions, and how do I do that? And can I get the screen pass button to work together with Fragment? At the moment I am doing in a way where I create framelayouts and leave as GONE, at the moment I click on the right arrow he changes the question, giving GONE in the previous one and VISIBLE in the next one, will not have any anim that do this same function of Fragment ?. Esse é o print da tela onde eu quero que aconteça essa função

  • This problem, in my view, involves programming logic. You can just "instantiate" the questions each time he passes the "next" button and create an animation that causes the illusion that Fragment jumped to the side, for example.

  • Yes, I’m doing more or less that, only besides going through the button, I also have to do finger dragging, like moving a Fragment

  • To move to the side you will have to use something called Viewpager (pager) and "inside" you will need a fragment adapter (Fragmentpageradapter). Fragmentpageradapter will have the size of the number of questions in a list...(actually the size is automatically found when you pass the list pro adapter).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.