Androidは仮想キーを隠し、フルスクリーンSystemUIUtils

734 ワード

/**
 * @  :TJ
 * @  :2018/9/14 16:26
 * @  :    ,       
 */
public class SystemUIUtils {


    /**
     *       ,    
     * getWindow().getDecorView()
     */
    protected void setStickFullScreen(View v) {
        //      ,    
        if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api
            v.setSystemUiVisibility(View.GONE);
        } else if (Build.VERSION.SDK_INT >= 19) {
            //for new api versions.
            int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                    | View.SYSTEM_UI_FLAG_FULLSCREEN;
            .setSystemUiVisibility(uiOptions);
        }
    }
}