change order of views in linear layout android

后端 未结 2 589
时光说笑
时光说笑 2020-11-30 13:33

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?

相关标签:
2条回答
  • 2020-11-30 14:05

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

    0 讨论(0)
  • 2020-11-30 14:19

    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.

    0 讨论(0)
提交回复
热议问题