简体   繁体   English

如何以相反的顺序将子视图添加到 LinearLayout?

[英]How to add child views to a LinearLayout in reverse order?

I am dynamically creating TextViews and adding those views in a LinearLayout .我正在动态创建TextViews并将这些视图添加到LinearLayout中。
I want to show the recently added TextView to the user.我想向用户展示最近添加的TextView
But the problem is that the LinearLayout is adding the views in a top-down manner.但问题是LinearLayout是以自上而下的方式添加视图。
How can I add the child views in reverse order?如何以相反的顺序添加子视图?

There is ViewGroup.addView(View child, int index) method.ViewGroup.addView(View child, int index)方法。 You can insert the newest TextView at the top of LinearLayout.您可以在 LinearLayout 的顶部插入最新的 TextView。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM