我想在图片底部添加一个渐变。就像这样:
我尝试了类似下面的方法,但只有渐变效果没有图片。
<ImageView
android:id="@+id/trendingImageView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/trend_donald_sterling"
android:src="@drawable/trending_gradient_shape"
/>
trending_gradient_shape:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="90"
android:endColor="@android:color/darker_gray"
android:startColor="@android:color/darker_gray" />
<corners android:radius="0dp" />
</shape>
android:endColor="#00000000" android:startColor="ff000000"
开始,并根据需要进行调整。 - nhaarman