具有可绘制对象,
<?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="#00000000"
android:centerColor="#00000000"
android:endColor="#eefff000"
android:type="linear" />
</shape>
使用as时
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/title_bk"
/>
出现错误:
android.view.InflateException: Binary XML file line #45: Binary XML file line #45: Error inflating class <unknown>
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.view.View.inflate(View.java:19790)
但是使用“#66000000”代替可绘制对象就可以了
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
/>
为什么?