change order of views in linear layout android-ThrowExceptions

Exception or error:

As you know the order of views in linear layout is related to the order of them in xml file. Is it possible to change that order with java code by something like indexing?

How to solve:

I would try to remove all views with removeView(view) and add them with addView(childView, index) in that order you like.

###

Remove the view, then add it to its new position by calling addView (View child, int index), specifying the position at which to add the view.

Leave a Reply

Your email address will not be published. Required fields are marked *