基本的に2つのラジオボタンを持つラジオグループがあり、そのうちの1つにRUNと表示され、もう1つにPASSというラベルが付いています。 この下にちょうど「Pass Complete」と書かれたチェックボックスがありますAndroid:最初に選択されているラジオボタンに応じて、チェックボックスを有効/無効にする方法
質問:RUNラジオボタンが選択されている(チェックボックスを選択できない)ときにチェックボックスを無効にして、 PASSラジオボタンが選択されていますか? IF文のいくつかのタイプを構築する助けがあれば、大歓迎です。
XML
<RadioGroup
android:id="@+id/runandpass"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
androidrientation="horizontal">
<RadioButton
android:id="@+id/radiobuttonrun"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="RUN" android:layout_weight="50"/>
<RadioButton
android:id="@+id/radiobuttonpass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PASS"
android:layout_weight="50"/>
</RadioGroup>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
androidrientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="50"
android:text="" />
<CheckBox
android:id="@+id/checkBoxcmpltpass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pass Complete"
android:layout_weight="6"/>
</LinearLayout>
JAVA
package com.aces.acesfootballuk;
import android.app.Activity;
import android.os.Bundle;
public class CoachesPage extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.coachespage);
}
};
基本的なJavaマニュアルとAndroid SDKの一部をお読みください –
...ありがとうとにかく –