1
我試圖實現的動畫繪製具有以下...加載器動畫空指針?
<?xml version="1.0" encoding="UTF-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" >
<item android:drawable="@drawable/load_0000" android:duration="50" />
<item android:drawable="@drawable/load_0001" android:duration="50" />
<item android:drawable="@drawable/load_0002" android:duration="50" />
<item android:drawable="@drawable/load_0003" android:duration="50" />
<item android:drawable="@drawable/load_0004" android:duration="50" />
<item android:drawable="@drawable/load_0005" android:duration="50" />
<item android:drawable="@drawable/load_0006" android:duration="50" />
<item android:drawable="@drawable/load_0007" android:duration="50" />
<item android:drawable="@drawable/load_0008" android:duration="50" />
<item android:drawable="@drawable/load_0009" android:duration="50" />
</animation-list>
然而,當我執行下面的代碼我得到後仰空指針...
ImageView img = (ImageView)findViewById(R.id.load_bar);
img.setBackgroundResource(R.drawable.loader_animation); //null here.
爲什麼? loader_animation是文件名,它位於繪製/