私は、より長いpressed_stateボタンのモーションクラスを持っています。それは本当にうまくいきます!
しかし、このコード ブロックで私のアクティビティが 2 回開始される理由を知っている人はいますか? 戻るボタンを押すときは、これを 2 回行う必要があります。
助けてくれてありがとう!
これは私のJavaコードです:
Button MenuBtnStart;
final Handler handlerBtnStart = new Handler();
MenuBtnStart.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(final View v, MotionEvent event) {
MenuBtnStart.setBackgroundDrawable(getResources().getDrawable(R.drawable.hover));
v.setPressed(true);
handlerBtnStart.postDelayed(new Runnable() {
public void run() {
Intent myIntent = new Intent(TextActivity.this, NextActivity.class);
TextActivity.this.startActivity(myIntent);
v.setPressed(false);
}
}, 900); // end of Handler new Runnable()
return true;
}
}); // end of OnTouchListener()