我無法將漸變背景應用於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