0

I need to display Math Formulas instead text in my RadioButton.
Formulas examples To display this Math Formulas i am using MathJax, but MathJax only display the Math Formulas in WebView, not in TextView. I tried to create a LinearLayout horizontal for each RadioButton + WebView and put all of this in a RadioGroup, but sadly when i check a RadioButton it is always checked, probably the RadioGroup doesn't work cause the LinearLayout.

Look:

    <!--******************************* CUSTOM RADIOGROUP *******************************-->
        <RadioGroup
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/RadioWebView"
            android:layout_below="@+id/rd_group_id">


            <!--******************************* QUESTAO 1 ***********************************-->
            <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            android:id="@+id/questao1"
            android:layout_marginTop="10dp">
            <RadioButton
                android:id="@+id/ebRadio1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="false"
                />

            <io.github.kexanie.library.MathView
                android:id="@+id/webviewQuestao1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                auto:text="\\(x \\over 2\\)"
                auto:engine="MathJax"
                android:layout_below="@+id/tv_QuestaoTexto"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true">
            </io.github.kexanie.library.MathView>
        </LinearLayout>


            <!--******************************* QUESTAO 2 ***********************************-->

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal"
                android:id="@+id/questao2"
                android:layout_marginTop="10dp">
                <RadioButton
                    android:id="@+id/ebRadio2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />

                <io.github.kexanie.library.MathView
                    android:id="@+id/webviewQuestao2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    auto:text="\\(-x \\over 2\\)"
                    auto:engine="MathJax"
                    android:layout_below="@+id/tv_QuestaoTexto"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true">
                </io.github.kexanie.library.MathView>
            </LinearLayout>


            <!--******************************* QUESTAO 3 ***********************************-->

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal"
                android:id="@+id/questao3"
                android:layout_marginTop="10dp">
                <RadioButton
                    android:id="@+id/ebRadio3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                   />

                <io.github.kexanie.library.MathView
                    android:id="@+id/webviewQuestao3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    auto:text="\\(x \\sqrt {2}\\)"
                    auto:engine="MathJax"
                    android:layout_below="@+id/tv_QuestaoTexto"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true">
                </io.github.kexanie.library.MathView>
            </LinearLayout>


            <!--******************************* QUESTAO 4 ***********************************-->

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal"
                android:id="@+id/questao4"
                android:layout_marginTop="10dp">
                <RadioButton
                    android:id="@+id/ebRadio4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />

                <io.github.kexanie.library.MathView
                    android:id="@+id/webviewQuestao4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    auto:text="\\({x \\sqrt {2}}\\over 23^{x+y+z}\\)"
                    auto:engine="MathJax"
                    android:layout_below="@+id/tv_QuestaoTexto"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true">
                </io.github.kexanie.library.MathView>
            </LinearLayout>


            <!--******************************* QUESTAO 5 ***********************************-->

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal"
                android:id="@+id/questao5"
                android:layout_marginTop="10dp">
                <RadioButton
                    android:id="@+id/ebRadio5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                     />

                <io.github.kexanie.library.MathView
                    android:id="@+id/webviewQuestao5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    auto:text="\\(y = {{{x \\sqrt {2}}\\over 23^{x+y+z}}-{x \\sqrt {xy+53}}\\over R^{3+y+z}}\\)"
                    auto:engine="MathJax"
                    android:layout_below="@+id/tv_QuestaoTexto"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true">
                </io.github.kexanie.library.MathView>
            </LinearLayout>


        </RadioGroup>
        <!--******************************* CUSTOM RADIOGROUP *******************************-->

And this is the result: RESULT

Someone knows how to display the WebView or turn the RadioButton uncheckable?
Thanks!

GLAPPs Mobile
  • 99
  • 1
  • 1
  • 12

1 Answers1

0

RadioGroup does not allow any ViewGroup as its child. It looks the only way to do this is to use individual radio buttons and then programmically control there on/off states.

Follow this link for more:

How to group RadioButton from different LinearLayouts?

Community
  • 1
  • 1
Rohit Sharma
  • 2,017
  • 1
  • 20
  • 22