2012-01-26 6 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> 
입니다

나는 어떤 몸이 알고있는 로그 캣 창에서 내 응용 프로그램

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

실행할 때 ??

답변

0

documentation에 설명 된 것처럼 menu.xml 파일을 대신 사용해야하는 경우 애니메이션 xml 파일의 내용으로 선호 화면을 부 풀릴 수 있기 때문입니다. 당신은 레이아웃에 특정보기를 찾을 때

또한 당신은 id 값은 당신이 프레임 애니메이션을 사용하려는 경우, 당신은 XML 파일을 생성하고 res/drawable 폴더와 refernce를보다 보관해야 R.id

보다으로 저장된 사용해야합니다 코드에, 이미지의 배경 리소스를 설정할 때 R.drawable.filename을 사용합니다. this도 참조하십시오.

관련 문제