0
我想用切換按鈕控制手機的全屏。我做到了,但它只能使用一次。我該如何解決它? 有代碼:全屏切換
final ToggleButton toggle_button_for_full_screen = (ToggleButton) findViewById(R.id.toggleButton1);
toggle_button_for_full_screen.setOnCheckedChangeListener(new OnCheckedChangeListener() {
boolean variable_for_saving_toggle_button_status;
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// TODO Auto-generated method stub
if (isChecked)
{
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
else
{
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
}
});
是的,它也適用於我,謝謝。 –
請嘗試您支持的所有版本。 –