Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make text glow programmatically (via code, not xml) in android?

I want to know how to make my text glow in android, I know how to do via xml with some attributes, like this:

android:shadowColor="#6A8B00"
android:shadowDx="3"
android:shadowDy="3"
android:shadowRadius="10"
android:text="@string/glowText"
android:textColor="#E15529"
android:textSize="30sp"

but I want to do via code, then I can control better and make glow more or less in different situations. Maybe has something like view.setGlow?

like image 300
Ricardo A. Avatar asked Feb 09 '23 00:02

Ricardo A.


1 Answers

You can use setShadowLayer (float radius, float dx, float dy, int color) on your textview. For example:

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

Found in the TextView documentation

like image 130
chris-pollux Avatar answered Feb 11 '23 00:02

chris-pollux