Reputation: 24012
In my application i have a form to be filled which contains 10-15 fields. so i thought making it interactive would make sense rather than showing all the 10-15 fields at a time.
I want it to be like:
App: question1 as a Text
User: answer1 in editText
App and User will be their respective ImageViews.
depending on the answer, 2nd question will be displayed.
Approach 1: have all the imageViews, TextViews and EditText fields visibility set to false and make them visible after answering the previous question (next question Text will depend on the answer)
actually i did this but there are few problems:
problem 1: i made the layout a ScrollView, so user can scroll to the bottom of the layout(where views are invisible) which tells him that this is a long form with views invisible.
problem 2: all the questions are TextViews, but all the answer fields are not EditText , some are spinners and some are checkboxes. so depending on the previous answer if i have to display a spinner or a checkbox wont work(it creates empty space if i skip any invisible view and go for the next view)
Approach 2: dynamically create all views (i believe this will take some time, which is a Ux issue again)
is there a better approach to achieve what i wanted?? and please let me know how to some my problem 1 and 2 if there is a solution
Upvotes: 0
Views: 341
Reputation: 5278
Use ViewStub instead of making invisible views. This way it won't occupy any space on the layout.
Upvotes: 2
Reputation: 7905
Well the simplest one would be each "section" of your wizard/questionnaire could be a seperate activity.
However I prefer adding and removing the elements from the same activity for this kind of task.
The other point you may want to think about is navigation, i.e. not only going forward to the next question but going back to the previous one. Keeping track of states in a single activity is not too bad, but then switching to a previous activity can potentially be simpler since each activity just keeps track of its next and previous activities.
Upvotes: 1