ラジオボタンが削除されたラジオオプションのセットを作成していますが、どのオプションが選択されているか知りたいと思います。ここでアンドロイドでアンドロイド:radiobutton = "@ null"を選択した場合のラジオオプションの選択方法
コード
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="200dp"
android:orientation="horizontal"
android:gravity="center_horizontal"
android:id="@+id/languages"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true">
<RadioButton
android:id="@+id/english"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="20dp"
android:text="@string/langtext_english"
android:textSize="16dp"
android:checked="true"
android:button="@null" />
<RadioButton
android:id="@+id/bahasaIndonesia"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/langtext_indonesian"
android:textSize="16dp"
android:button="hide"/>
</RadioGroup>
である私は、ラジオボタンを表示したくないが、私は選択されたオプション知っていただきたいと思います。ボタンがないため、onCheckedChangedListenerは機能しません。これを行う方法?
オプションをタッチまたはクリックすると、トーストを表示したいと思います。
View rootView = inflater.inflate(R.layout.fragment_home, container, false);
langChosen = (RadioGroup) rootView.findViewById(R.id.languages);
langChosen.setOnClickListener(new RadioGroup.OnClickListener() {
@Override
public void onClick(View v) {
Toast abc = new Toast(getContext());
abc.makeText(getContext(), v.toString(),Toast.LENGTH_LONG);
}
"ラジオボタンを表示したくないですが、どのオプションが選択されているか知りたいです。"ボタンを表示しない場合、どのようにユーザーが知っていますか、どのオプションが選択されていますか? – Alex
@Alex「太字の」オプションで表示する予定です。どのオプションが選択されていても、太字で表示されます。 –