我需要在我的 RadioButton
中显示数学公式。
公式示例要显示此数学公式,我正在使用MathJax
,但是MathJax
仅在WebView
中显示数学公式,而不是在TextView
中。我试图为每个RadioButton
WebView
创建一个LinearLayout
水平,并将所有这些都放入RadioGroup
中,但是可悲的是,当我检查RadioButton
时,请始终检查它,可能是RadioGroup
不起作用,因为LinearLayout
。
看:
<!--******************************* 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 *******************************-->
这就是结果:结果
有人知道如何显示WebView
或将RadioButton
转动无法检查?
谢谢!
radiogroup不允许任何视图组作为其孩子。看起来唯一的方法是使用单个无线电按钮,然后在此处进行编程控制。
按下此链接以获取更多信息:
如何从不同的线性层层中分组radiobutton?