Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何更改MathView文本的颜色?这基本上是一个网络视图_Android_Android Studio_Katex - Fatal编程技术网

Android 如何更改MathView文本的颜色?这基本上是一个网络视图

Android 如何更改MathView文本的颜色?这基本上是一个网络视图,android,android-studio,katex,Android,Android Studio,Katex,下面是项目:github.com/kexanie/MathView 我只找到了一种方法来改变背景和前圆形的颜色 XML: 答案如下: 首先更改配置: formula.config( "MathJax.Hub.Config({\n"+ " { TeX: { extensions: [\"color.js\"] } }\n"+ "});" ); 然后: 只需将白色更改为您需要的颜色。我使用了MathJax引擎 <io.github.kexanie.library.M

下面是项目:github.com/kexanie/MathView

我只找到了一种方法来改变背景和前圆形的颜色

XML:

答案如下:

首先更改配置:

formula.config(
    "MathJax.Hub.Config({\n"+
    "  { TeX: { extensions: [\"color.js\"] } }\n"+
    "});"
);
然后:


只需将白色更改为您需要的颜色。

我使用了MathJax引擎

<io.github.kexanie.library.MathView
            android:id="@+id/formula_one"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="@color/colorGrey"
            auto:text="\\(\\color{Gray}{When a \\ne 0\\, there are two solutions to \\(ax^2 + bx + c = 0\\)
    and they are $$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$}\\)"
            auto:engine="MathJax">

        </io.github.kexanie.library.MathView>


通过这种方式,您可以直接从XML设置文本,而无需更改配置:)

因为Math View扩展了Web View,所以问题是如何更改Web View的文本颜色这个答案帮助了我,我使用了十六进制的颜色格式(例如白色:#ffffff)

formula.config(
    "MathJax.Hub.Config({\n"+
    "  { TeX: { extensions: [\"color.js\"] } }\n"+
    "});"
);
formula.setText("\\(\\color{white}{ax^2 + 7}\\)");
<io.github.kexanie.library.MathView
            android:id="@+id/formula_one"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="@color/colorGrey"
            auto:text="\\(\\color{Gray}{When a \\ne 0\\, there are two solutions to \\(ax^2 + bx + c = 0\\)
    and they are $$x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a}.$$}\\)"
            auto:engine="MathJax">

        </io.github.kexanie.library.MathView>