本文整理汇总了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);
}
示例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);
}
}
示例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());
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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'");
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}