Reputation: 199
I want to create a transparent gradient like in Play Music.
drawable/shadow_up.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:startColor="#FF00FF00"
android:endColor="#00FFFFFF"/>
</shape>
layout/main_layout.xml:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="25dp"
android:background="@drawable/shadow_up"/>
</LinearLayout>
But the gradient is not transparent. How to fix this?
The gradient from Play Music:
It transparent.
Upvotes: 4
Views: 1875
Reputation: 987
The most probable answer is that your gradient view does NOT overlap the list view - in other words, the list view is above your gradient, the gradient xml is correct, its the views that are positioned wrong. You should try something more like this
<ReltaiveLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
Your litview goes here, with both dimensions match parent
<View
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="25dp"
android:background="@drawable/shadow_up"/>
</RelativeLayout>
Upvotes: 5