Inner shadow on Android TextView

Is it possible to put an inner shadow on Android TextView text like this:

http://i.stack.imgur.com/88Mxd.png

Thanks!

+6
source share
3 answers

This is a duplicate of the question I asked a few months ago: Is there a way to add an inner shadow to the TextView on Android?

There is no suitable way to do this at the moment. But if you try to play with alpha the colors of the text and shadow, you may get something close to the inner shadow.

+1
source

MagicTextView will do internal shadows.

enter image description here

  <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?

+7
source

Shadow effect:

  <TextView android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="5sp" android:paddingTop="15sp" android:paddingBottom="15sp" android:typeface="normal" android:text="I'm normal (bold) font but I have a shadow" android:textSize="16sp" android:textStyle="bold" android:shadowColor ="#0f0f0f" android:shadowRadius="1.6" android:shadowDx="1.5" android:shadowDy="1.3" android:textColor="#000000" android:background="#ffffff" /> 

Or you can use your own fonts, put them in the res / assets folder:

 TextView txt = (TextView) findViewById(R.id.custom_font); Typeface font = Typeface.createFromAsset(getAssets(), "my_font.ttf"); txt.setTypeface(font); 

Or check the following links for details:

http://www.barebonescoder.com/2010/05/android-development-using-custom-fonts/

and

http://www.giantflyingsaucer.com/blog/?p=1421

+2
source

Source: https://habr.com/ru/post/900502/


All Articles