【发布时间】:2014-03-07 18:19:28
【问题描述】:
我有带有 RadioGroup 的 RelativeLayout 视图。我正在尝试将 RadioGroup 嵌入到 RelativeLayout。所以要向我的布局添加元素。我的代码在这里
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<RadioGroup
android:id="@+id/rg1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RadioButton
android:id="@+id/r1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Example1"
android:checked="true"
/>
<RadioButton
android:id="@+id/r2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Example2"
android:checked="true"
/>
</RadioGroup>
这样做会显示异常:
This RadioGroup layout or its RelativeLayout parent is possibly useless
我该如何解决这个警告?
【问题讨论】:
-
RadioGroup是您的RelativeLayout中唯一的东西吗?如果是这样,那将是无用的。此外,这只是一个警告,因此可以忽略并继续运行。
标签: android xml android-layout adt