Programmatically add Views inside a (Linear)Layout (that is inside a ScrollView)

核能气质少年 提交于 2019-12-05 16:32:50

I am not very sure how you inflate your comments, but here is how I would do it.

Declare the comments Layout as a LinearLayout and give it an id, and then get a reference to that LinearLayout :

LinearLayout commentsLayout=(LinearLayout)findViewById(R.id.commentsLayoutId);

and then just add child Views to this layout :

commentsLayout.addView(newComment);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!