It's possible to put a TextView inside of a RadioGroup. But, is it good practice?

前端 未结 3 2239
醉话见心
醉话见心 2021-02-20 17:38

What I\'m trying to accomplish: When the user clicks a specific RadioButton, a TextView should appear immediately below the selected RadioButton.

相关标签:
3条回答
  • 2021-02-20 18:15

    Two options:

    1. Doing something similar as you said but it doesn't need to be inside the RadioGroup. Making the TextView visible when the user clicks on the RadioButton.
    2. Perhaps you can do something with a ViewStub. Check this link.
    0 讨论(0)
  • 2021-02-20 18:18

    Is putting the TextView inside of the RadioGroup valid (or, good practice)?

    RadioGroup is just a LinearLayout that happens to also handle RadioButton exclusion rules (i.e., "there can only be one...checked, that is"). I see no particular problems in having a TextView inside a RadioGroup.

    0 讨论(0)
  • 2021-02-20 18:18

    yeah it is possible check this method

    <RadioGroup
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/radioGroup"
        android:orientation="horizontal">
    
        <RadioButton
            android:id="@+id/ifsc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/ifsc"
            android:textAllCaps="true" />
        <Textview
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/appName"
            android:id="@+id/ifsc_info"
            android:baselineAlignBottom="true"
            android:layout_toEndOf="@+id/ifsc" />
    
    </RadioGroup>
    
    0 讨论(0)
提交回复
热议问题