Imagebuttonがあり、ActionDOWNにsetColorFilterを設定しましたが、ユーザーがImageButtonから指をスライドさせた場合、setColorFilterが適用されたままになります。
質問:
指が滑り落ちるのを検出する方法は?次に、setColorFilter(null);を適用できます。
ImageButton i1 =(ImageButton)v.findViewById(R.id.imageButton1); i1.setOnTouchListener(new OnTouchListener(){
@Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub ImageButton button = (ImageButton)v; String principal = "principal"; if (event.getAction() == MotionEvent.ACTION_DOWN) { button.setColorFilter(0x8066bbdd); return true; } else if (event.getAction() == MotionEvent.ACTION_UP) { button.setColorFilter(null); Intent i = new Intent(getActivity(), SubView.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.putExtra("query", principal); startActivity(i); return true; } return false; } });