Eclipse的抱怨在布局XML元素的无用 [英] Eclipse complains about uselessness of elements in layout xml
问题描述
我有一个滚动视图。滚动型只能包含一个元素,所以我把我的RadioGroup中和下面的按钮(它充当一个占位符)内的TableLayout。
I have a scrollview. A scrollview can only contain one element so I put my RadioGroup and the button below (which acts as a placeholder) inside a TableLayout.
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal" >
<TableLayout
android:layout_width="300sp"
android:layout_height="wrap_content" >
<TableRow>
<RadioGroup
android:id="@+id/radioStateChoice"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RadioButton
android:id="@+id/radioW"
style="@style/CheckboxRadioStyle"
android:checked="true"
android:text="@string/wien" />
<RadioButton
android:id="@+id/radioNoe"
style="@style/CheckboxRadioStyle"
android:text="@string/noe" />
<RadioButton
android:id="@+id/radioOoe"
style="@style/CheckboxRadioStyle"
android:text="@string/ooe" />
<!-- there are usually more radio buttons -->
<!-- I have shortened it to keep the example smaller -->
</RadioGroup>
</TableRow>
<TableRow>
<Button
android:layout_width="60sp"
android:layout_height="50sp"
android:visibility="invisible" />
</TableRow>
</TableLayout>
</ScrollView>
现在的Eclipse显示我的XML警告:的RadioGroup中布局或其母公司的TableRow可能是无用的
。
他们怎么会没用?首先,我需要的RadioGroup中获取选定的单选按钮:
Now Eclipse shows me an xml warning: "The RadioGroup layout or its TableRow parent is possibly useless"
.
How can they be useless? First of all, I need the radiogroup to access the selected radio button:
int selectedRadioId = radioGroup.getCheckedRadioButtonId();
RadioButton selectedRadioButton = (RadioButton)findViewById(selectedRadioId);
和所述TableLayout需要由于这样的事实,即我只能有滚动型内的一个元素。我选择了,因为下面的占位符按钮的TableView中。那么,有什么不对吗?
And the TableLayout is needed due to the fact, that I can only have one element inside the ScrollView. I chose a TableView because of the placeholder button below. So what's wrong with that?
推荐答案
我觉得这是一个使用表行元素的父,因为在表格布局。
I think it's because of using table row element as parent of in table layout.
你可以从XML删除elelment因为有行添加到表的布局。
you can just remove elelment from xml because has add the row to Table layout.
用作为父母是无用的在这里,所以月食告诉你一个没用父母的
Using as a parent of is Useless here so eclipse show you a warning of an useless parent for
这篇关于Eclipse的抱怨在布局XML元素的无用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!