我想知道如何使文本在android中发光,我知道如何通过具有某些属性的xml来进行操作,例如:
android:shadowColor="#6A8B00"
android:shadowDx="3"
android:shadowDy="3"
android:shadowRadius="10"
android:text="@string/glowText"
android:textColor="#E15529"
android:textSize="30sp"
但是我想通过代码来完成,然后我可以更好地控制并在不同情况下或多或少地使光晕。也许有类似view.setGlow的东西?
您可以在文本视图上使用setShadowLayer (float radius, float dx, float dy, int color)
。例如:
textView.setShadowLayer(30, 0, 0, Color.RED);
在TextView documentation中找到