对背景图像的渐变效果

时间:2016-09-13 19:19:08

标签: android

enter image description here

我想尝试这样的观点。如您所见,背景图像有渐变效果。为此,我尝试了以下代码:

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:background="@drawable/profile_background"
    android:src="@drawable/gradient" />

这是gradient.xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <gradient
        android:angle="90"
        android:endColor="#00202239"
        android:startColor="#aa202239"
        android:centerColor="#00202239" />

    <corners android:radius="0dp" />
    </shape>

结果:

enter image description here

如何解决此问题?

0 个答案:

没有答案