회전하는 화살표를 만들려고합니다. 그게 onclick 회전.임의의 시간이 지나면 회전하는 이미지
랜덤 시간 후에 멈 춥니 다.
하드 비트 임의의 위치에서 중지 할 화살표 이미지를 얻는 것입니다. 여기
지금까지 내 코드입니다 :private Button btnRotate, btnstop;
private ImageView imgview;
AnimationListener listener;
Random rand = new Random();
int milis = (rand.nextInt(10) + 2)*1000;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_what, container, false);
TextView txt = (TextView) rootView.findViewById(R.id.textView1);
Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/harabara.ttf");
txt.setTypeface(font);
final ImageView iv = (ImageView) rootView.findViewById(R.id.image_arrow);
btnRotate = (Button) rootView.findViewById(R.id.start);
final Animation rotation = AnimationUtils.loadAnimation(getActivity(), R.anim.button_rotate);
rotation.setRepeatCount(Animation.INFINITE);
rotation.setAnimationListener(listener);
btnRotate.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
iv.startAnimation(rotation);
new java.util.Timer().schedule(
new java.util.TimerTask() {
@Override
public void run() {
iv.clearAnimation();
}
}, milis);
}
});
return rootView;
}
나중에 당신이 할 수있는 내가 오래 전' – MilapTank
Timer.schedule (taskPlaySound를 대답을 게시 할 예정입니다 잠시 솔루션 대기를() (이 5000 + rnd.nextInt (45000))' –