0
我在RadioGroup上遇到了一些麻烦。出于某种原因,它无法找到我的RadioButton中的一个的ID。找不到与RadioGroup名称相匹配的资源
错误:
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>
所以这是给我的errror线路:
android:checkedButton="@id/euro1">
即使单选按钮下方有一个确切的ID。我究竟做错了什么?谢谢。
谢谢。我最终通过在id中添加一个加号来解决问题,如下所示:android:checkedButton =“@ + id/euro1”。我想你的工作也会如此! – Jesper