当用户在抬头通知中左右滑动时,我知道您可以setDeleteIntent
捕获此手势并编写自定义意图被触发。
但是是否可以检测到用户延缓通知时用户何时在抬头通知中向上滑动,因为此时他们没有关闭通知,因此删除意图从未被触发?
我想知道用户是向上还是向左滑动通知。
答案 0 :(得分:0)
如果您开始检测到common gestures,对您有用吗?对于我相信的通知,可以遵循相同的方法。
public class MainActivity extends Activity {
@Override
public boolean onTouchEvent(MotionEvent event){
int action = MotionEventCompat.getActionMasked(event);
switch(action) {
case (MotionEvent.ACTION_DOWN) :
Log.d(DEBUG_TAG,"Action was DOWN");
return true;
case (MotionEvent.ACTION_MOVE) :
Log.d(DEBUG_TAG,"Action was MOVE");
return true;
case (MotionEvent.ACTION_UP) :
Log.d(DEBUG_TAG,"Action was UP");
return true;
case (MotionEvent.ACTION_CANCEL) :
Log.d(DEBUG_TAG,"Action was CANCEL");
return true;
case (MotionEvent.ACTION_OUTSIDE) :
Log.d(DEBUG_TAG,"Movement occurred outside bounds " +
"of current screen element");
return true;
default :
return super.onTouchEvent(event);
}
}