您好,我必须显示数字本身的进度。我遇到过 TextView 中使用的 Shader,Gradient 用于文本的水平多色。他们有没有这样的内置 API 来绘制下图中的字符?
提前致谢
最佳答案
您可以在完全相同的位置创建两个 TextView,一白一绿。设置其中一个的高度,以便文本被剪裁并且仅部分覆盖另一个。
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#990000" >
<TextView
android:id="@+id/text_green"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="58dp"
android:layout_y="77dp"
android:text="50"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#009900"
android:textSize="100sp" />
<TextView
android:id="@+id/text_white"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_x="58dp"
android:layout_y="77dp"
android:text="50"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF"
android:textSize="100sp" />
</AbsoluteLayout>
关于android - 在 Android TextView 中显示进度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20381124/