2016-12-13 31 views
0

我需要顯示數學公式,而不是文本在我的RadioButton
​​ 要顯示此數學公式,我使用的是MathJax,但MathJax僅在WebView中顯示數學公式,而不在TextView中。 我試圖創建一個LinearLayout水平爲每RadioButton + WebView,並把所有這一切都在RadioGroup,但遺憾的是,當我檢查RadioButton它總是檢查,可能是RadioGroup不起作用引起LinearLayout如何在RadioButton中顯示WebView?

看:

<!--******************************* 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 *******************************--> 

這是結果: RESULT

有人知道如何顯示WebView或轉RadioButton uncheckable?
謝謝!

回答

0

RadioGroup不允許任何ViewGroup作爲其子。它看起來唯一的方法就是使用單獨的單選按鈕,然後以編程方式控制開/關狀態。

請點擊此鏈接獲取更多:

How to group RadioButton from different LinearLayouts?

+0

它現在可以正常使用,謝謝! –