public boolean onTouch(View v, MotionEvent event) {
final int DELAY = 100;
if(event.getAction() == MotionEvent.ACTION_UP) {
RelativeLayout fondo = (RelativeLayout) findViewById(R.id.background);
ColorDrawable f = new ColorDrawable(0xff00ff00);
ColorDrawable f2 = new ColorDrawable(0xffff0000);
ColorDrawable f3 = new ColorDrawable(0xff0000ff);
ColorDrawable f4 = new ColorDrawable(0xff0000ff);
AnimationDrawable a = new AnimationDrawable();
a.addFrame(f, DELAY);
a.addFrame(f2, DELAY);
a.addFrame(f3, DELAY);
a.addFrame(f4, DELAY);
a.setOneShot(false);
fondo.setBackgroundDrawable(a); // This method is deprecated in API 16
// fondo.setBackground(a); // Use this method if you're using API 16
a.start();
}
return true;
}
我想代替上述ontouch布爾值,我的背景更改顏色時查看和不touch.like按按鈕轉到一個新的佈局,然後沒有觸摸屏幕開始閃爍如何將觸摸布爾值更改爲像查看
您的問題不清楚......您想要執行一次什麼操作? – Massimo
好吧,其實我想換成觸摸,我不想觸摸屏幕,我想打開一個佈局,看到我的背景閃爍,它只是碰巧鍛煉出那種方式, –