基本上我有一個有兩個單選按鈕的無線電組,其中一個標記爲RUN,另一個標記爲PASS。 正下方,我還有一個複選框,標記爲「通過完成」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 – 2012-03-23 17:51:04
......非常感謝 – 2012-03-23 18:01:08