2017-07-21 28 views
-2

我想在下面的圖像底部實現TextView的背景效果。 對不起我的英文不好... enter image description hereTextView的白色文字

+0

你是什麼意思的圖像的文本視圖? – rubenwardy

+0

你在運行時改變了textview的顏色嗎? –

+0

使用setBackground方法並使用漸變創建自定義繪圖。 –

回答

1

您可以創建你的背景繪製

your_drawable.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="oval"> 
    <gradient android:angle="0" 
     android:endColor="#fff" 
     android:startColor="#c86e6e6e" 
     android:gradientRadius="100dp" 
     android:type="radial"/> 
</shape> 

,並加入到TextView的:

<TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="TEST" 
     android:textColor="#fff" 
     android:background="@drawable/your_drawable" 
     android:padding="90dp" 
     android:textSize="30sp"/> 
+0

你的愛人是對的,它激勵了我。謝謝! –

0

你必須使用漸變比例。去檢查文檔的更多細節