我无法将渐变背景应用于线性布局.
从我所读到的来看,这应该是相对简单的,但它似乎就是行不通.为了参考起见,我在2.1上开发-更新1.
Header_bg.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:startColor="#FFFF0000"
android:endColor="#FF00FF00"
android:type="linear"/>
</shape>
main_header.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:orientation="horizontal"
android:background="@drawable/header_bg">
</LinearLayout>
如果我把@drawable/header_bg改成一种 colored颜色 ,例如#FF0000,效果非常好.我是不是漏掉了什么明显的东西?