当前位置: 首页>>代码示例>>Java>>正文


Java View.getSystemUiVisibility方法代码示例

本文整理汇总了Java中android.view.View.getSystemUiVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java View.getSystemUiVisibility方法的具体用法?Java View.getSystemUiVisibility怎么用?Java View.getSystemUiVisibility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.getSystemUiVisibility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setFullScreen

import android.view.View; //导入方法依赖的package包/类
static void setFullScreen(Map message) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ) { 
        return;
    }

    final Boolean value = (Boolean) message.get("value");
    final Activity activity = QtNative.activity();

    Runnable runnable = new Runnable () {
        public void run() {
            Window w = activity.getWindow(); // in Activity's onCreate() for instance
            View decorView = w.getDecorView();

            int config = decorView.getSystemUiVisibility();

            if (value) {
                config &= ~View.SYSTEM_UI_FLAG_FULLSCREEN;
            } else {
                config |= View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
            }
            decorView.setSystemUiVisibility(config);
        }
    };

    activity.runOnUiThread(runnable);

}
 
开发者ID:benlau,项目名称:androidnative.pri,代码行数:28,代码来源:Util.java

示例2: removeVisibilityFlag

import android.view.View; //导入方法依赖的package包/类
/**
 * Convenience method to remove a visibility flag from the view, leaving other flags that are
 * not specified intact.
 */
public static void removeVisibilityFlag(final View view, final int flag) {
    if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
        final int vis = view.getSystemUiVisibility();
        view.setSystemUiVisibility(vis & ~flag);
    }
}
 
开发者ID:Trumeet,项目名称:SetupWizardLibCompat,代码行数:11,代码来源:SystemBarHelper.java

示例3: showSystemUI

import android.view.View; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
private void showSystemUI() {
    View decorView = getWindow().getDecorView();
    previousUiVisibility = decorView.getSystemUiVisibility();
    onConfigurationChanged(getResources().getConfiguration());

}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:8,代码来源:MainActivity.java

示例4: setFlag

import android.view.View; //导入方法依赖的package包/类
public static void setFlag(Activity activity, int flag){
    if (Build.VERSION.SDK_INT >= 19){
        View decorView = activity.getWindow().getDecorView();
        int option = decorView.getSystemUiVisibility() | flag;
        decorView.setSystemUiVisibility(option);
    }
}
 
开发者ID:z-chu,项目名称:FriendBook,代码行数:8,代码来源:SystemBarUtils.java

示例5: clearLightStatusBar

import android.view.View; //导入方法依赖的package包/类
public static void clearLightStatusBar(@NonNull View view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        int flags = view.getSystemUiVisibility();
        flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        view.setSystemUiVisibility(flags);
    }
}
 
开发者ID:haihaio,项目名称:AmenEye,代码行数:8,代码来源:ViewUtil.java

示例6: setWindowLightStatusBar

import android.view.View; //导入方法依赖的package包/类
public static void setWindowLightStatusBar(Activity activity, Boolean lightStatusBar) {
  Window window = activity.getWindow();
  View decor = window.getDecorView();
  //取消设置透明状态栏,使 ContentView 内容不再覆盖状态栏
  window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  //需要设置这个 flag 才能调用 setStatusBarColor 来设置状态栏颜色
  window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
  int ui = decor.getSystemUiVisibility();
  if (lightStatusBar) {
    ui |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  } else {
    ui &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
  }
  decor.setSystemUiVisibility(ui);
}
 
开发者ID:Lingzh0ng,项目名称:BrotherWeather,代码行数:16,代码来源:StatusBarTextColorUtils.java

示例7: setLightStatusBar

import android.view.View; //导入方法依赖的package包/类
public static void setLightStatusBar(View view, Activity activity) {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            View decor = activity.getWindow().getDecorView();
            oldStatusBarFlags = decor.getSystemUiVisibility();
            int flags = view.getSystemUiVisibility();
            flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            view.setSystemUiVisibility(flags);
            activity.getWindow().setStatusBarColor(Color.WHITE);
        }


    }
 
开发者ID:cahergil,项目名称:Farmacias,代码行数:14,代码来源:Utils.java

示例8: setStatusBarStyle

import android.view.View; //导入方法依赖的package包/类
private void setStatusBarStyle(final String style) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (style != null && !style.isEmpty()) {
            View decorView = cordova.getActivity().getWindow().getDecorView();
            int uiOptions = decorView.getSystemUiVisibility();

            String[] darkContentStyles = {
                "default",
            };

            String[] lightContentStyles = {
                "lightcontent",
                "blacktranslucent",
                "blackopaque",
            };

            if (Arrays.asList(darkContentStyles).contains(style.toLowerCase())) {
                decorView.setSystemUiVisibility(uiOptions | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
                return;
            }

            if (Arrays.asList(lightContentStyles).contains(style.toLowerCase())) {
                decorView.setSystemUiVisibility(uiOptions & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
                return;
            }

            LOG.e(TAG, "Invalid style, must be either 'default', 'lightcontent' or the deprecated 'blacktranslucent' and 'blackopaque'");
        }
    }
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:31,代码来源:StatusBar.java

示例9: setLightStatusBar

import android.view.View; //导入方法依赖的package包/类
public static void setLightStatusBar(@NonNull View view) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        int flags = view.getSystemUiVisibility();
        flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        view.setSystemUiVisibility(flags);
    }
}
 
开发者ID:xxczaki,项目名称:music-player,代码行数:8,代码来源:ViewUtils.java

示例10: setStatusBarDarkIcon

import android.view.View; //导入方法依赖的package包/类
/**
 * 设置状态栏颜色
 *
 * @param view
 * @param dark
 */
private static void setStatusBarDarkIcon(View view, boolean dark) {
    int oldVis = view.getSystemUiVisibility();
    int newVis = oldVis;
    if (dark) {
        newVis |= SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
    } else {
        newVis &= ~SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
    }
    if (newVis != oldVis) {
        view.setSystemUiVisibility(newVis);
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:19,代码来源:MeiZuStatusbarColorUtils.java

示例11: showNavigationBar

import android.view.View; //导入方法依赖的package包/类
public static void showNavigationBar(Window window) {
    if (window == null) {
        return;
    }

    window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

    final View decorView = window.getDecorView();

    if (decorView != null) {
        int uiOptions = decorView.getSystemUiVisibility();

        if (Build.VERSION.SDK_INT >= 14) {
            uiOptions &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE;
        }

        if (Build.VERSION.SDK_INT >= 16) {
            uiOptions &= ~View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        }

        if (Build.VERSION.SDK_INT >= 19) {
            uiOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        }

        decorView.setSystemUiVisibility(uiOptions);
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:29,代码来源:AndroidInputUtil.java

示例12: clearFlag

import android.view.View; //导入方法依赖的package包/类
public static void clearFlag(Activity activity, int flag){
    if (Build.VERSION.SDK_INT >= 19){
        View decorView = activity.getWindow().getDecorView();
        int option = decorView.getSystemUiVisibility() & (~flag);
        decorView.setSystemUiVisibility(option);
    }
}
 
开发者ID:newbiechen1024,项目名称:NovelReader,代码行数:8,代码来源:SystemBarUtils.java

示例13: enableLightStatusBar

import android.view.View; //导入方法依赖的package包/类
public static void enableLightStatusBar(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        View view = activity.getWindow().getDecorView();

        int flags = view.getSystemUiVisibility();
        flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
        view.setSystemUiVisibility(flags);
    }
}
 
开发者ID:OhMyLob,项目名称:Paper-Launcher,代码行数:10,代码来源:SystemBarUtil.java

示例14: showNavigationBar

import android.view.View; //导入方法依赖的package包/类
private static void showNavigationBar(Context context) {
    View decorView = scanForActivity(context).getWindow().getDecorView();
    int systemUiVisibility = decorView.getSystemUiVisibility();
    int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN;
    systemUiVisibility &= ~flags;
    decorView.setSystemUiVisibility(systemUiVisibility);
}
 
开发者ID:dueeeke,项目名称:dkplayer,代码行数:9,代码来源:WindowUtil.java

示例15: hideNavigationBar

import android.view.View; //导入方法依赖的package包/类
/**
 * <pre>{@code
 * @Override
 * public void onWindowFocusChanged(boolean hasFocus) {
 *   super.onWindowFocusChanged(hasFocus);
 *   if (hasFocus) {
 *     // place here
 *   }
 * }
 * }</pre>
 */

public static void hideNavigationBar(Window window) {
    if (window == null) {
        return;
    }

    window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    final View decorView = window.getDecorView();

    if (decorView != null) {
        int uiOptions = decorView.getSystemUiVisibility();

        if (Build.VERSION.SDK_INT >= 14) {
            uiOptions |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
        }

        if (Build.VERSION.SDK_INT >= 16) {
            uiOptions |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        }

        if (Build.VERSION.SDK_INT >= 19) {
            uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        }

        decorView.setSystemUiVisibility(uiOptions);
    }
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:41,代码来源:AndroidInputUtil.java


注:本文中的android.view.View.getSystemUiVisibility方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。