2015-10-07 83 views
0

我正在开发一个需要有这种文本格式的android应用程序,为此我在下面的代码中显示的textview中使用shadowcolor,但是我无法完全实现。任何帮助将不胜感激。 这里是我的TextView代码:在Textview中创建文字阴影android

<TextView 
     android:id="@+id/textpage" 
     android:textAlignment="center" 
     android:layout_marginLeft="@dimen/book_page_text_view_margin" 
     android:layout_marginRight="@dimen/book_page_text_view_margin" 
     android:gravity="bottom|center_horizontal" 
     android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. " 
     android:textColor="#050505" 
     android:textSize="16sp" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     local:MvxBind="Text PageText" 
     android:layout_marginBottom="2dp" 
     android:layout_marginTop="20dp" 
     android:shadowColor="#ffffff" 
     android:shadowDx="-1" 
     android:shadowDy="-1" 
     android:shadowRadius="3" 
     android:textStyle="bold" 
     android:fadingEdge="horizontal" 
     android:scrollHorizontally="true" /> 

Here is the image showing required text style in rectangle area

+0

参考http://stackoverflow.com/questions/ 3297437/shadow-effect-for-text-in-android – sasikumar

+0

我已经添加了shadowcolor,shadowRadius,它完全不适合我我需要。 – AndroidFan

回答

0

嗯...第一个解决方案击在我的脑海中只是使用的字体。我的意思是使用不同的字体样式你可以实现它。

Drop Shadow Fonts

这里是不同类型的可用字体。我从来没有尝试过,但是按照我的经验,它会工作;)。

只是尝试一下,让我知道。 :)

0

试试这将有助于

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:background="@color/Black" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<TextView android:textColor="@color/White" 
android:layout_width="wrap_content" 
android:text="Your Text" 
android:layout_height="wrap_content" 
android:padding="2dp" 
android:shadowColor="@color/White" 
android:shadowDx="0" 
android:shadowDy="0" 
android:shadowRadius="3" /> 
</LinearLayout> 
+0

是否有效?或者试试这种方式https://github.com/m5/MagicTextView –