-
Notifications
You must be signed in to change notification settings - Fork 0
Home
MathML-Android is a small math-ml support lib. it's customized view that extend with webview. this view you can add directly in your layout-xml or you can add as view.
dependency: in your asset folder should have below html file
letx.html
LETXViewer
public method:
loadLETX(String letx)
how to implement
layout-xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <to.hurix.com.letx.LETXViewer android:id="@+id/letxView" android:layout_width="match_parent" android:layout_height="match_parent" ></to.hurix.com.letx.LETXViewer> </LinearLayout>
code level
`public class MainActivity extends AppCompatActivity { private LETXViewer view; private EditText letxEdit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
view = (LETXViewer)findViewById(R.id.letxView);
letxEdit =(EditText)findViewById(R.id.editText);
letxEdit.setText("\\[\\frac{{7.0\\, \\times \\,{{10}^6}}}{{3.5\\, \\times \\,{{10}^3}}} = \\frac{{7.0\\, \\times \\,10\\, \\times \\,10\\, \\times \\,10\\, \\times \\,\\rlap{-}1 \\rlap{-}0\\, \\times \\,\\rlap{-}1 \\rlap{-}0\\, \\times \\,\\rlap{-}1 \\rlap{-}0}}{{3.5\\, \\times \\,\\rlap{-}1 \\rlap{-}0\\, \\times \\,\\rlap{-}1 \\rlap{-}0 \\times \\,\\rlap{-}1 \\rlap{-}0}}\\]");
view.loadLETX("\\[\\frac{{7.0\\, \\times \\,{{10}^6}}}{{3.5\\, \\times \\,{{10}^3}}} = \\frac{{7.0\\, \\times \\,10\\, \\times \\,10\\, \\times \\,10\\, \\times \\,\\rlap{-}1 \\rlap{-}0\\, \\times \\,\\rlap{-}1 \\rlap{-}0\\, \\times \\,\\rlap{-}1 \\rlap{-}0}}{{3.5\\, \\times \\,\\rlap{-}1 \\rlap{-}0\\, \\times \\,\\rlap{-}1 \\rlap{-}0 \\times \\,\\rlap{-}1 \\rlap{-}0}}\\]");
letxEdit.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
view.loadLETX(editable.toString());
}
});
}
}`