2
사용자가 통화중인 동안 터치 이벤트를 사용하거나 사용하지 않도록 설정해야하는 발신 화면에서 작업하고 있습니다.Android 기기에서 화면 터치 사용 안함
protected void sleepScreen(boolean on){
if(on == true) {
WindowManager.LayoutParams params = getWindow().getAttributes();
params.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
getWindow().setAttributes(params);
} else {
WindowManager.LayoutParams params = getWindow().getAttributes();
params.flags |= WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON;
getWindow().setAttributes(params);
}
}
FLAG_NOT_TOUCHABLE 잘 비활성화 터치 이벤트를 작동합니다
public void onSensorChanged(SensorEvent sensorEvent) {
if(sensorEvent.sensor.getType() == Sensor.TYPE_PROXIMITY) {
if(sensorEvent.values[0] == 0) { //Sleep
sleepScreen(true);
} else { //Wake
sleepScreen(false);
}
}
}
아래는 내 sleepScreen() 방법 :이 나는 onSensorChanged() 메소드를 내 활동 SensorEventListener를 구현하고 무시를 들어
. 그러나 터치 이벤트를 다시 사용하도록 설정할 수는 없습니다.
Pls help!