volley통신으로 name을 받아와서 동적으로 라디오 버튼을 생성하였는데요 그리고 xml부분에 있는 라디오 그룹에 radiogroup.addView(b_place); 해주었습니다.
<RadioGroup
android:id="@+id/RadioGroup"
android:orientation="horizontal"
android:layout_width="350dp"
android:layout_marginLeft="8dp"
android:layout_height="wrap_content" />
이렇게 orientation이 horizontal으로 되어있어서
라디오버튼1 라디오버튼2 라디오버튼3 라디오버튼4 라디오버튼5 라디오버튼6...
이렇게 일자로 나오게 되는데 3개씩끊어서
라디오버튼1 라디오버튼2 라디오버튼3
라디오버튼4 라디오버튼5 라디오버튼6
.
.
이렇게 만들고 싶은데 방법이 어떻게 될까요
RadioGroup radiogroup = (RadioGroup)getView().findViewById(R.id.RadioGroup);
final RadioButton b_place = new RadioButton(getContext());
b_place.setText(name);
b_place.setWidth(230);
b_place.setHeight(90);
b_place.setTextSize(16);
b_place.setId(i);
b_place.setTextSize(15);
b_place.setTextColor(Color.GRAY);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
b_place.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.textlines2));
} else {
b_place.setBackgroundDrawable(ContextCompat.getDrawable(getContext(), R.drawable.textlines2));
}
radiogroup.addView(b_place);
이부분이 라디오버튼을 동적생성한부분이고요
어떻게하면 일자로, 쭉 나오지않고 나눠서 나올수있을까요.,,
girdlayout 에 넣으면 나눠서나오지만 라디오버튼이 라디오그룹처럼 한개씩만 선택이안되고
여러개 선택이 되네요ㅠㅠ