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布尔值,我的背景在查看时不改变颜色。如按一个按钮转到新布局然后不触摸屏幕开始闪烁
答案 0 :(得分:1)
我们仍然需要更清楚地帮助,而不是完全确定你要做的事情。
如果我理解正确你想按一个按钮,然后打开一个屏幕闪烁的新布局?