How to inflate a view in a determined position?
- by Tivie
I have an activity with an "Add" and a "Delete" button.
The "Add Button" inflates a view, the "Delete Button" removes a selected View.
When I inflate a view with the "Add Button", it is automatically drawn below any previously infalted view.
I would like to give the user the possibility to move each inflated view up and down, so he could change the order they are show in screen (in a drag'n'drop kind of effect)
+---------------------+ +---------------------+
| +-----------------+ | | +-----------------+ |
| | View 1 | | | | View 2 | |
| +-----------------+ | | +-----------------+ |
| | --> | |
| +-----------------+ | | +-----------------+ |
| | View 2 | | | | View 1 | |
| +-----------------+ | | +-----------------+ |
+---------------------+ +---------------------+
Is it possible to specify the "position" in which each view is inflated? (for instance, below or above the currently selected view?)
If not, what is the best way to accomplish the desired effect?
(feel free to ask for any piece of code, if you think it might help)