Android 未找到与给定名称和组匹配的资源
我和一个放射组有点麻烦。由于某种原因,它找不到我的一个单选按钮的id 错误:Android 未找到与给定名称和组匹配的资源,android,xml,Android,Xml,我和一个放射组有点麻烦。由于某种原因,它找不到我的一个单选按钮的id 错误: Error:(18, 32) No resource found that matches the given name (at 'checkedButton' with value '@id/euro1'). 我的代码: <RadioGroup android:layout_width="wrap_content" android:layout_height="wrap_content"
Error:(18, 32) No resource found that matches the given name (at 'checkedButton' with value '@id/euro1').
我的代码:
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/betGroup"
android:checkedButton="@id/euro1">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/euro1"
android:drawableLeft="@drawable/euromoent1"
android:layout_marginBottom="10dp"/>
<RadioButton
android:drawableLeft="@drawable/euromoent2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/euro2"
android:layout_marginBottom="10dp"/>
<RadioButton
android:drawableLeft="@drawable/euro5small"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/euro5"
android:layout_marginBottom="10dp"/>
<RadioButton
android:drawableLeft="@drawable/euro10small"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/euro10"
android:layout_marginBottom="10dp"/>
<RadioButton
android:drawableLeft="@drawable/euro20small"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/euro20" />
</RadioGroup>
即使下面的单选按钮有准确的id,我做错了什么?谢谢 您不能在无线组上使用android:checkedButton=“@id/euro1”> 将android:checked=“false”添加到每个单选按钮。无论您想检查哪个,请添加
android:checked=“true”
类似于选中按钮:
<RadioButton
android:drawableLeft="@drawable/euro5small"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/euro5"
android:checked="true"
android:layout_marginBottom="10dp"/>
<RadioButton
android:drawableLeft="@drawable/euro5small"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/euro5"
android:checked="false"
android:layout_marginBottom="10dp"/>
对于未选中的按钮:
<RadioButton
android:drawableLeft="@drawable/euro5small"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/euro5"
android:checked="true"
android:layout_marginBottom="10dp"/>
<RadioButton
android:drawableLeft="@drawable/euro5small"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/euro5"
android:checked="false"
android:layout_marginBottom="10dp"/>
从radiogroup中删除android:checkedButton=“@id/euro1”>此
希望能有所帮助谢谢。我最终解决了这个问题,在id中添加了一个加号,如:android:checkedButton=“@+id/euro1”。我想你的也会有用的!