本文整理汇总了Java中android.view.View.setSystemUiVisibility方法的典型用法代码示例。如果您正苦于以下问题:Java View.setSystemUiVisibility方法的具体用法?Java View.setSystemUiVisibility怎么用?Java View.setSystemUiVisibility使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setSystemUiVisibility方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enabledFullScreenMode
import android.view.View; //导入方法依赖的package包/类
private void enabledFullScreenMode() {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
示例2: _setUiLayoutFullscreen
import android.view.View; //导入方法依赖的package包/类
/**
* 设置UI沉浸式显示
*/
private void _setUiLayoutFullscreen() {
if (Build.VERSION.SDK_INT >= 14) {
// 获取关联 Activity 的 DecorView
View decorView = mAttachActivity.getWindow().getDecorView();
// 沉浸式使用这些Flag
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
);
mAttachActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
示例3: fullscreen
import android.view.View; //导入方法依赖的package包/类
private void fullscreen() {
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
// ActionBar actionBar = getActionBar();
// actionBar.hide();
}
示例4: 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);
}
示例5: setStatusBar
import android.view.View; //导入方法依赖的package包/类
/**
* 设置状态栏颜色
*/
private void setStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
View decorView = getWindow().getDecorView();
int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(option);
getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimary));
}else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
示例6: setSystemUiVisible
import android.view.View; //导入方法依赖的package包/类
/** Toggle whether the system UI (status bar / system bar) is visible.
* This also toggles the action bar visibility.
* @param show True to show the system UI, false to hide it.
*/
void setSystemUiVisible(boolean show) {
mSystemUiVisible = show;
Window window = getActivity().getWindow();
WindowManager.LayoutParams winParams = window.getAttributes();
View view = getView();
ActionBar actionBar = getActivity().getActionBar();
if (show) {
// Show status bar (remove fullscreen flag)
window.setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Show system bar
view.setSystemUiVisibility(View.STATUS_BAR_VISIBLE);
// Show action bar
actionBar.show();
} else {
// Add fullscreen flag (hide status bar)
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Hide system bar
view.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
// Hide action bar
actionBar.hide();
}
window.setAttributes(winParams);
}
示例7: 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);
}
}
示例8: setLightStatusBar
import android.view.View; //导入方法依赖的package包/类
public static void setLightStatusBar(View view, Activity activity){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
int flags = view.getSystemUiVisibility();
flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
view.setSystemUiVisibility(flags);
activity.getWindow().setStatusBarColor(Color.WHITE);
}
}
示例9: enableImmersiveMode
import android.view.View; //导入方法依赖的package包/类
public void enableImmersiveMode(final View decorViewOfActivity) {
decorViewOfActivity.setSystemUiVisibility(getImmersiveUiVisibility());
decorViewOfActivity.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorViewOfActivity.setSystemUiVisibility(getImmersiveUiVisibility());
}
}
});
}
示例10: onCreate
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
//android.app.ActionBar actionBar = getActionBar();
// actionBar.hide();
setContentView(R.layout.activity_ppt_web_view);
// mVisible = true;
// mControlsView = findViewById(R.id.fullscreen_content_controls);
// mContentView = findViewById(R.id.fullscreen_content);
//
//
// // Set up the user interaction to manually show or hide the system UI.
// mContentView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// toggle();
// }
// });
Intent intent=getIntent();
String url=intent.getStringExtra("modulelink");
url=url.replaceAll(" ","%20");
webView = (WebView)findViewById(R.id.webView2);
webView.getSettings().setJavaScriptEnabled(true);
Uri uri = Uri.parse("https://www.example.com");
// webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src=http%3a%2f%2fvideo.ch9.ms%2fbuild%2f2011%2fslides%2fTOOL-532T_Sutter.pptx");
// webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src=https://www.dropbox.com/s/2scazhwg7o5l2z3/SE1.pptx?dl=1");
// webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src=https://www.dropbox.com/s/n775vtevnwlqzlg/test.pptx?dl=1");
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webView.setWebViewClient(new WebViewClient());
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
// webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src=http%3a%2f%2fvideo.ch9.ms%2fbuild%2f2011%2fslides%2fTOOL-532T_Sutter.pptx");
webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src="+url);
// Upon interacting with UI controls, delay any scheduled hide()
// operations to prevent the jarring behavior of controls going away
// while interacting with the UI.
// findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
}
示例11: hideLandscapeSystemUI
import android.view.View; //导入方法依赖的package包/类
private void hideLandscapeSystemUI() {
final View decorView = getActivity().getWindow().getDecorView();
// Set the IMMERSIVE flag.
// Set the content to appear under the system bars so that the content
// doesn't resize when the system bars hide and show.
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE);
}
示例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: hideStatusbar
import android.view.View; //导入方法依赖的package包/类
public static void hideStatusbar(Activity context) {
if (Build.VERSION.SDK_INT < 16) {
context.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
View decorView = context.getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
}
示例14: hideStatusBar
import android.view.View; //导入方法依赖的package包/类
private void hideStatusBar() {
// If the Android version is lower than Jellybean, use this call to hide
// the status bar.
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
//Hide the Status Bar on Android 4.1 and Higher
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
示例15: showLandscapeSystemUI
import android.view.View; //导入方法依赖的package包/类
private void showLandscapeSystemUI() {
final View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}