2015-10-07 84 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 –