【问题标题】:How to make text glow programmatically (via code, not xml) in android?如何在android中以编程方式(通过代码,而不是xml)使文本发光?
【发布时间】:2016-01-15 17:05:38
【问题描述】:

我想知道如何让我的文本在 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 的东西?

【问题讨论】:

    标签: android textview android-xml glow


    【解决方案1】:

    您可以在您的文本视图上使用setShadowLayer (float radius, float dx, float dy, int color)。例如:

    textView.setShadowLayer(30, 0, 0, Color.RED);
    

    在TextView中找到documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-03
      • 2023-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多