我想创建一个像Play Music一样的透明渐变。
抽拉/ 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>
布局/ 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>
但渐变不透明。如何解决这个问题?
播放音乐的渐变:
透明。
答案 0 :(得分:3)
最可能的答案是您的渐变视图不会与列表视图重叠 - 换句话说,列表视图位于渐变之上,渐变xml是正确的,其视图位置错误。你应该尝试更像这样的东西
<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>