Android MathView溢出父视图的宽度

时间:2017-09-10 12:31:28

标签: android mathjax tex mathml

我使用https://github.com/kexanie/MathViewTexCode tutorial在MathView中显示数学方程式。当我打开活动时,MathView会在几次后加载。但是,即使我将MathView设置为与父宽度匹配,它也超出了父视图宽度。我试图将MathView放在Horizo​​ntalScrollView中,但是加载MathView需要花费很长时间。我需要一个解决方案来在父LinearLayout中加载MathView。

依赖

 compile 'io.github.kexanie.library:MathView:0.0.6'

activity_main.xml中

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
>
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:auto="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:paddingBottom="@dimen/activity_vertical_margin"
        tools:context=".MainActivity"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Sum of n terms of this A.P."
            />

        <io.github.kexanie.library.MathView
            android:id="@+id/formula_two"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            auto:text="$${n\\over2}[2a+(n-1)d]$$"
            auto:engine="MathJax"
            >
        </io.github.kexanie.library.MathView>

        <io.github.kexanie.library.MathView
            android:id="@+id/formula_three"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            auto:text="Or, $${n\\over2}[FirstTerm+LastTerm]$$"
            auto:engine="MathJax"
            >
        </io.github.kexanie.library.MathView>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Other important results"
            />

        <io.github.kexanie.library.MathView
            android:id="@+id/formula_four"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            auto:text="$$(1+2+3+..+n)={n(n+1) \\over 2}$$"
            auto:engine="MathJax"
            >
        </io.github.kexanie.library.MathView>

        <io.github.kexanie.library.MathView
            android:id="@+id/formula_four2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            auto:text="$$(1^2+2^2+3^2+..+n^2)= {n(n+1)(2n+1) \\over 6}$$"
            auto:engine="MathJax"
            >
        </io.github.kexanie.library.MathView>

        <io.github.kexanie.library.MathView
            android:id="@+id/formula_four3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            auto:text="$$(1^3+2^3+3^3+..+n^3)={n^2(n+1)^2 \\over 4} $$"
            auto:engine="MathJax"
            >
        </io.github.kexanie.library.MathView>


        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="2. Geometrical Progression (G.P.):"
            android:textColor="#2c3e50"
            />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Example:"
            />

        <io.github.kexanie.library.MathView
            android:id="@+id/formula_five"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            auto:text="$$a,ar,ar^2,ar^3,...$$"
            auto:engine="MathJax"
            >
        </io.github.kexanie.library.MathView>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="In Geometrical Progression(G.P.) nth term is "
            />

        <io.github.kexanie.library.MathView
            android:id="@+id/formula_six"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            auto:text="$$ar^{n−1}$$"
            auto:engine="MathJax"
            >
        </io.github.kexanie.library.MathView>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="In Geometrical Progression(G.P.) Sum of the n terms "
            />

        <io.github.kexanie.library.MathView
            android:id="@+id/formula_seven"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            auto:text="$${a(1−r^n) \\over 1−r}$$"
            auto:engine="MathJax"
            >
        </io.github.kexanie.library.MathView>

    </LinearLayout>
 </ScrollView>

</LinearLayout>

快照

MathView Overflow Issue1 MathView Overflow Issue2]

0 个答案:

没有答案