登錄從未登錄ACTION_UP或ACTION_MOVE(這是我從代碼示例中刪除縮短)onInterceptTouchEvent的ACTION_UP和ACTION_MOVE不會被調用
這裏是我的代碼的縮短版:
public class ProfileBadgeView extends LinearLayout {
Activity act;
public ProfileBadgeView(Context context) {
super(context);
}
public ProfileBadgeView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public ProfileBadgeView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public void initView(Activity act) {
//..init
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
logIntercept("ACTION DOWN");
} else if (ev.getAction() == MotionEvent.ACTION_UP) {
logIntercept("ACTION_UP");
}
return false;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return true;
}
private void logIntercept(Object obj) {
Log.i(this.getClass().getSimpleName() + " INTERCEPT :", obj.toString());
}
}
將敬酒的條件之外,並檢查是否顯示敬酒 –