0
어떻게 동적으로 생성 된 모든 radioButton을 하나의 그룹으로 그룹화 할 수 있습니까?안드로이드 TableLayout 그룹 dynamic radioButtons
while (cursor.moveToNext()) {
TableRow row = new TableRow(this);
// CheckBox chk = new CheckBox(this);
RadioButton radioBtn = new RadioButton(this);
// chk.setText(cursor.getString(cursor.getColumnIndex("from_text")));
radioBtn.setText(cursor.getString(cursor.getColumnIndex("from_text")));
radioBtn.
row.addView(radioBtn);
table.addView(row);
}
XML을
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
<TableLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/myTable"/>
</LinearLayout>