7 つのラジオボタンを持つラジオグループがあり、それらを次のように整列させたい場合:
           button2    button5
button1    button3    button6
           button4    button7
1つのRadioGroupで上記を実行できる方法はありますか(最初の行にbutton1があっても問題ありませんが、これは私が探している一般的なレイアウトです)
助けてください
ありがとう
7 つのラジオボタンを持つラジオグループがあり、それらを次のように整列させたい場合:
           button2    button5
button1    button3    button6
           button4    button7
1つのRadioGroupで上記を実行できる方法はありますか(最初の行にbutton1があっても問題ありませんが、これは私が探している一般的なレイアウトです)
助けてください
ありがとう
このhttp://developer.android.com/reference/android/widget/RadioGroup.OnCheckedChangeListener.htmlに基づいて、独自のボタン処理ロジックを実装できます。
public class RadioButtonHandler implements RadioButton.OnCheckedChangeListener {
    private CompoundButton currentlyCheckedButton = null;
    public void onCheckedChanged(CompoundButton button, boolean isChecked) {
            if (isChecked) {
               currentlyCheckedButton .setChecked(false);
               currentlyCheckedButton = button;
            }
    }
    public void addButton(RadioButton button) {
           // if this is the first button, set it as the current button
           if (currentlyCheckedButton == null) {
               currentlyCheckedButton = button;
           }
           button.setOnCheckedChangeListener(this);
    }
    public CompoundButton getCheckedRadioButton() {
        return currentlyCheckedButton ;
    } 
}
このクラスをインスタンス化し、クラスが制御する各ボタンに対して addButton を呼び出します。次に、必要なビュー グループにボタンを配置できます。onCheckChanged コールバックに追加のロジックを追加するか、現在チェックされているボタンへの参照を返す getCheckedRadioButton を呼び出します。
[編集] タイプミスを修正 = getCheckedButton -> getCheckedRadioButton