2012-01-26 3 views
1

私はバイナリXMLファイルの行#3:エラー膨らまクラスアニメーションリスト

public class anim extends PreferenceActivity { 
@Override 
protected void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
addPreferencesFromResource(R.anim.anim); 
ImageView img = (ImageView)findViewById(R.anim.anim); 
img.setBackgroundResource(R.anim.anim); 
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground(); 
frameAnimation.start(); 
} 
} 

このクラスを呼び出すときに、それが実行のXMLファイルにアニメーションを追加しようとしていますここでxmlファイルは

<animation-list xmlns:android="http://schemas.android.com/apk/res/android" > 

<item android:drawable="@drawable/bee00" android:duration="50" /> 
<item android:drawable="@drawable/bee01" android:duration="50" /> 
<item android:drawable="@drawable/bee02" android:duration="50" /> 
<item android:drawable="@drawable/bee03" android:duration="50" /> 
<item android:drawable="@drawable/bee04" android:duration="50" /> 
<item android:drawable="@drawable/bee05" android:duration="50" /> 
<item android:drawable="@drawable/bee06" android:duration="50" /> 
    <item android:drawable="@drawable/bee07" android:duration="50" /> 
    <item android:drawable="@drawable/bee08" android:duration="50" /> 
    <item android:drawable="@drawable/bee09" android:duration="50" /> 
    <item android:drawable="@drawable/bee10" android:duration="50" /> 
</animation-list> 
です

私はすべてのボディが知っているLogCatウィンドウに自分のアプリケーション

Binary XML file line #3: Error inflating class animation-list 

を実行します?

答えて

0

documentationのように、代わりにmenu.xmlファイルを使用する必要がある場合は、アニメーションxmlファイルの内容でお気に入りの画面を膨張させるからです。あなたが使用する必要があるレイアウトで特定のビューを見つけたとき

はまた、それはあなたがフレームアニメーションを使用したい場合は、XMLファイルを作成し、res/drawableフォルダにとrefernceよりも、それを保存する必要がありますよりもR.id

に保存されたid値ですコードには、画像の背景リソースを設定するときにR.drawable.filenameを使用します。 thisも参照してください。

関連する問題