Android warning “This TableRow view is useless (no children, no background, no id)”

时光总嘲笑我的痴心妄想 提交于 2019-12-24 02:25:27

问题


A warning occours in eclipse when I tried to make a android table layout in xml this warning comes at table row of the layout part:

This TableRow view is useless (no children, no background, no id)

<TableRow android:layout_width="fill_parent" android:layout_height="wrap_content">
</TableRow>

Plese tell me how to overcome this warning.Thanks in advance.


回答1:


If you know that you use this TableRow (e.g. you add children to it later in the code) just ignore the warning.

Upd: you can't use this TableRow in code without id assigned to it. Why do you need the TableRow?




回答2:


That situation appears when you have only one "RowTable" section.

Try to add second empty section, eg.

<TableRow android:id="@+id/tableRow2"> 

In my case it works.




回答3:


If you have single table layout then make Table layout parent remove any other parent tag.

You have similar problem try this Solution



来源:https://stackoverflow.com/questions/8848428/android-warning-this-tablerow-view-is-useless-no-children-no-background-no-i

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