假设您将使用线性布局(我考虑过垂直线性布局)..并且在您的线性布局下方有一个视图。现在为这个视图提供一个开始颜色和结束颜色..我也想得到这个东西,它为我工作..如果您需要更好的效果,那么只需围绕开始和结束颜色进行处理。
活动主
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/vertical"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="@drawable/layout_back_bgn"
android:orientation="vertical" >
</LinearLayout>
<View
android:layout_below="@+id/vertical"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="@drawable/shadow"
>
</View>
</LinearLayout>
layout_back_bgn.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="#FF4500" />
</shape>
影子.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="#4D4D4D"
android:endColor="#E6E6E6"
android:angle="270"
>
</gradient>
</shape>
我尝试发布使用上述代码后拥有的图像,但stackoverflow不允许我因为我没有声誉......对此感到抱歉。