ビューなどにアタッチされていないカスタムクラスの BitmapStorage がいくつかあります。これはユーティリティです。そして、アニメーション フレームを含む <animation-list> を含む Born_animation.xml ファイルがあります。
<animation-list oneshot="true" >
<item drawable="@drawable/frame01" />
<item drawable="@drawable/frame02" />
</animation-list>
Resources クラスを使用して xml ファイルから AnimationDrawable としてアニメーションをロードし (すべての解析を行うため)、ビットマップを抽出してカスタム ストレージ クラスに配置します。
私が持っている問題:
Resources res = context.getResources();
AnimationDrawable drawable = (AnimationDrawable)res.getDrawable(R.drawable.born_animation);
assertTrue( drawable != null ); <= fails! it's null
なんてこと?誰かが私にそれを説明できますか?コードは正常にコンパイルされます。すべてのリソースが配置されています。
別の方法を試しました-ImageViewを使用して解析を行います(開発ガイドで説明されているように)
ImageView view = new ImageView(context);
view.setBackgroundResource(R.drawable.born_animation);
AnimationDrawable drawable = (AnimationDrawable)view.getBackground();
assertTrue( drawable != null ); <= fails! it's null
結果は同じです。null ドローアブルを返します。
事前に感謝します。