Мне нужно использовать RadioGroup в моем приложении. Но я не могу его инициализировать в своей деятельности. В чем проблема?Как инициализировать RadioGroup
my screen for example
screen 2
Мне нужно использовать RadioGroup в моем приложении. Но я не могу его инициализировать в своей деятельности. В чем проблема?Как инициализировать RadioGroup
my screen for example
screen 2
привет сделал вам попробовать что-то вроде этого,
RadioGroup mRadioGroup = (RadioGroup) view.findViewById(R.id.amountcollecte_radiogroup);
mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
int id = mRadioGroup.getCheckedRadioButtonId();
View radioButton = mRadioGroup.findViewById(id);
if (radioButton.getId() == R.id.amountcollected_yes_radioButton) {
} else if (radioButton.getId() == R.id.amountcollected_no_radioButton) {
}
}
});
<RadioButton
android:id="@+id/amountcollected_yes_radioButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="@color/black"
android:checked="true"
android:gravity="center"
android:text="Yes"
android:textColor="@color/black"
android:textSize="@dimen/text_large" />
<RadioButton
android:id="@+id/amountcollected_no_radioButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:buttonTint="@color/black"
android:gravity="center"
android:text="No"
android:textColor="@color/black"
android:textSize="@dimen/text_large" />
</RadioGroup>
надеюсь, что это поможет.
Вы можете добавить код, который вы пробовали, вместо изображения –
@NeelaySrivastava, почему?) На моем изображении две строки)) – JokeRaes