andriod全屏设置

andriod 全屏 窗口全屏 活动全屏 窗口全屏是指隐藏系统顶部的时间 电量,活动全屏指的是隐藏活动的标题栏

窗口全屏 代码如下

    /* 全屏显示 */
    public static void setFullscreen(final Activity context) {
        final Window win = context.getWindow();
        final WindowManager.LayoutParams winParams = win.getAttributes();
        final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN;
        winParams.flags |= bits;
        win.setAttributes(winParams);
    }

窗体全屏

方式一

    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
               //该行代码必须在setContentView之前
                requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_login);
    }

方式二

        
        

andriod系统版本和对应的API

系统版本 API cat
4.0.03-4.0.04 15 foo
4.1 16 bar
4.2 17 baz
4.3 18 bar
4.4 19 baz
5.0 21 bar
5.1 22 baz
6.0 23 bar
7.0 24 baz
7.1 25 baz
8 26 baz

获取LayoutInflater方法

1.(LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE)

2.LayoutInflater.from(activity);

Dialog 对话框样式

    

获取SharedPreferences

        final SharedPreferences sh = context.getSharedPreferences(DESIRED_PREFEREVCE_FILENAME, Context.MODE_PRIVATE);
        final Editor editor = sh.edit();
        editor.putString(Key.UserMenulist, authorizeData.getMenuList());

        editor.commit();

你可能感兴趣的:(andriod全屏设置)