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