Questions.java
public void onClick(View v) {
if (q1.isChecked()) {
int count = 0;
for (CheckBox cb : cbList) {
if (cb.isChecked()) {
count++;
}
}
if (count <= 1) {
new AlertDialog.Builder(this).setMessage(R.string.negative).show();
} else {
new AlertDialog.Builder(this).setMessage(R.string.positive).show();
}
}
}
question.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<CheckBox
android:id="@+id/q1a"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/sas1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sas1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
note: never mind the checkbox
how to put add code that when the text(textview) is clicked, an image will appear( like an alert dialog) something like that.?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…