我无法将渐变背景应用于LinearLayout。Android LinearLayout渐变背景
这应该是相对简单的,因为我已阅读,但它似乎并没有工作。有关参考资料,我正在开发2.1-update1。
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>
如果我改变@抽拉/ header_bg到彩色 - 例如#FF0000它工作得很好。我在这里错过了很明显的东西吗
机器人:机器人backgroundTint:backgroundTintMode http://stackoverflow.com/a/43341289/3209132 – 2017-04-28 07:44:27