Dynamically added table rows not appearing

人走茶凉 提交于 2019-12-05 11:09:43
Michael Greifeneder

Change the two references

ViewGroup.LayoutParams

to

TableRow.LayoutParams

and it should work.

Adding layout params to a widget requires that the LayoutParams are a inner class of the surrounding layout container.

I think this has something to do with you setting the layout params to the TextViews. If you remove those definitions the info appears. Also if you take a look at the official documentation for TableRow you can see:

The children of a TableRow do not need to specify the layout_width and layout_height attributes in the XML file. TableRow always enforces those values to be respectively MATCH_PARENT and WRAP_CONTENT.

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