如何在android中绘制混合或多色的线?

时间:2017-06-07 05:13:39

标签: android

我不需要一系列图纸。我只需要在Android中如何绘制混合颜色或多色的线条。

1 个答案:

答案 0 :(得分:0)

  

尝试这个

multicolor.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<gradient 
android:type="linear"
android:centerX="44%" 
android:startColor="#FF00ff00" 
android:centerColor="#FFFF0000" 
android:endColor="#FFffff00" 
android:angle="90"/>
</shape>

<强> line.xml

<View
        android:layout_width="match_parent"
        android:layout_height="5dp"
        android:background="@drawable/multicolor" />