android屏蔽返回键

 
 
import android.view.KeyEvent;

public boolean onKeyDown(int kCode, KeyEvent kEvent) {
    switch (kCode) {
    case KeyEvent.KEYCODE_DPAD_LEFT: {
        return true;
    }

    case KeyEvent.KEYCODE_DPAD_UP: {
        return true;
    }

    case KeyEvent.KEYCODE_DPAD_RIGHT: {
        return true;
    }

    case KeyEvent.KEYCODE_DPAD_DOWN: {
        return true;
    }
    case KeyEvent.KEYCODE_DPAD_CENTER: {
        return true;
    }
    case KeyEvent.KEYCODE_BACK: {
        return false;
    }
    }
    return super.onKeyDown(kCode, kEvent);
}




你可能感兴趣的:(android,UP,import)