Android MathView Overflows Width of the Parent View

937 views Asked by At

I am using https://github.com/kexanie/MathView and TexCode tutorial to show mathematics equations in MathView. When I open the activity, MathView loads after a few time. But it exceeds the parent view width even when I've set MathView to match parent width. I tried to put MathView inside HorizontalScrollView, but it takes forever to load MathView. I need a solution to load MathView inside the parent LinearLayout.

Dependency

 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>

SNAPSHOTS

MathView Overflow Issue1 MathView Overflow Issue2]

0

There are 0 answers