Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I would like to make an inner shadow on a textview, But I can't find any example of that on the web.

Is there any way to do that on Android?

I know these attributes:

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

Am I missing something useful?

like image 417
Romain Piel Avatar asked Jul 29 '11 09:07

Romain Piel


People also ask

Can we Nest TextView inside TextView?

In Android all layout can be nested one another.

How do I add background color to TextView?

To change the background color of TextView widget, set the background attribute with required Color value. You can specify color in rgb , argb , rrggbb , or aarrggbb formats. The background color is applied along the width and height of the TextView.


1 Answers

If you're looking for inner shadows like these:

enter image description here

You could 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 made this, and am posting more for the sake of future travelers than the OP. It's borderline spam, but being on-topic, perhaps acceptable?

like image 154
ABentSpoon Avatar answered Oct 04 '22 19:10

ABentSpoon