Is there a way to add an inner shadow to a TextView on Android?

I would like to make an inner shadow on a textview , but I cannot find a single example of this on the Internet.

Is there any way to do this on Android?

I know these attributes:

 android:shadowColor android:shadowRadius android:shadowDx android:shadowDy 

Am I missing something useful?

+13
android textview shadow
Jul 29 2018-11-11T00:
source share
2 answers

If you want the TextView have an inner shadow like this:

enter image description here

you need to use a 9-patch, like this one:

enter image description here

Set the 9-patch to draw as the background of the TextView.

The attributes you mention are: android:shadowColor, android:shadowRadius, android:shadowDx, android:shadowDy are for other purposes, they create a text shadow:

enter image description here

+10
Sep 19 2018-11-11T00:
source share

If you are looking for inner shadows such as:

enter image description here

You can try MagicTextView

  <com.qwerjk.better_text.MagicTextView xmlns:qwerjk="http://schemas.android.com/apk/res/com.qwerjk.better_text" android:textSize="42dp" android:textColor="#FFffff00" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textStyle="bold" android:padding="10dp" qwerjk:innerShadowDy="3" qwerjk:innerShadowColor="#FF000000" qwerjk:innerShadowRadius="5" android:text="InnerShadow" /> 

Note: I have done this and am sending more for future travelers than OP. This is border spam, but on the subject, perhaps acceptable?

+19
Apr 24 '12 at 8:13
source share



All Articles