마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

remoteviews 클래스에서, 이미지뷰를 따오고싶어요!!ㅠㅠㅠㅠ

0 추천

 

 

remoteview  에 속해있는 이미지뷰를 따와서, animdrawble을 만들고싶은데 

 

findviewbyId 같은 메소드도 안먹고그러니 도통 방법을 모르겠네요 ㅠㅠㅠ

 

 

 

제가 쓰려는 코드는 이거에요!

ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image);
 img.setBackgroundResource(R.drawable.spin_animation);

 // Get the background, which has been compiled to an AnimationDrawable object.
 AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();

 

 

도와주시면 감사하겠습니다 ㅠㅠㅠㅠ

 

 

bombermin (2,520 포인트) 님이 2014년 11월 25일 질문

1개의 답변

0 추천
public class Animation1Activity extends Activity {
ImageView imageView ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.animation1);
imageView = (ImageView) findViewById(R.id.imageView_animation1);
imageView.setBackgroundResource(R.drawable.animation1_drawable);
}
public void myClickHandler(View targetButton){
// 가져오기 AnimationDrawable 대상
AnimationDrawable animationDrawable = (AnimationDrawable)imageView.getBackground();
// 애니메이션 실행 여부
if(animationDrawable.isRunning()){
//애니메이션 중지 재생
animationDrawable.stop();
}
else{
//아니면 계속 애니메이션 재생 시작
animationDrawable.start();
}
}
}
 
doridori2013@nate.com
익명사용자 님이 2014년 11월 26일 답변
...