Gravity.BOTTOM); Window window = dialogMyAddress.getWindow(); Window window1 = getWindow();// window.getDecorView...().setMinimumWidth(getResources().getDisplayMetrics().widthPixels);//window.getDecorView().setBackgroundColor...默认是有 padding 的,大小为 42,可以通过 mWindow.getDecorView().getPaddingTop() 来获取。...().setMinimumWidth(getResources().getDisplayMetrics().widthPixels);window.getDecorView().setBackgroundColor...().setMinimumWidth(getResources().getDisplayMetrics().widthPixels); window.getDecorView().setBackgroundColor
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); window.setStatusBarColor(Color.TRANSPARENT); window.getDecorView...window.setStatusBarColor(Color.TRANSPARENT); if (isDarkMode()) { int uiOption = window.getDecorView...().getSystemUiVisibility(); //没有DARK_STATUS_BAR属性,通过位运算将LIGHT_STATUS_BAR属性去除 window.getDecorView....setSystemUiVisibility(uiOption & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } else { window.getDecorView...; window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); //window.getDecorView
finish; 第二步,重写Activity的onBackPressed()方法 @Override public void onBackPressed() { getWindow().getDecorView...Activity的onStart()方法 @Override protected void onStart() { super.onStart(); getWindow().getDecorView...getWindow().getDecorView().postDelayed(mFinishRunnable, 1000 * 10); moveTaskToBack(true); }...mFinishRunnable . */ @Override protected void onStart() { super.onStart(); getWindow().getDecorView
withoutUseStatusBarColor) { //android6.0以后可以对状态栏文字颜色和图标进行修改 getWindow().getDecorView...Activity通过上面的设置,可以实现如下效果: 上面设置状态栏文字颜色和图标为暗色主要采用了以下两个标志: //设置状态栏文字颜色及图标为深色 getWindow().getDecorView()...//设置状态栏文字颜色及图标为浅色 getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN...transaction, fourFragment, thirdFragment, secondFragment, homeFragment);//展示第一个fragment getWindow().getDecorView.../展示第二个fragment if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { //实现状态栏图标和文字颜色为暗色 getWindow().getDecorView
View decorView = getWindow().getDecorView(); // int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION...View decorView =this.getWindow().getDecorView(); decorView.setSystemUiVisibility(...{ super.onCreate(savedInstanceState); hideBottomUIMenu(); this.getWindow().getDecorView...* @param window */ public void hideNavigationBar(final Window window) { window.getDecorView...(); mProgressDialog.setTextSize(v,24); mProgressDialog.getWindow().getDecorView
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.getDecorView...} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { activity.getWindow().getDecorView...FlymeSetStatusBarLightMode(activity.getWindow(), true); } else if (type == 3) { activity.getWindow().getDecorView...,旧方法无效但不会报错,所以两个方式都要加上 if (dark) { activity.getWindow().getDecorView...View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } else { activity.getWindow().getDecorView
把subDecor返回赋值给mSubDecor } } } 总结一下createSubDecor方法,一共做了三件事: 1 this.mWindow.getDecorView...下面分析这三步骤 Step1 this.mWindow.getDecorView(); this.mWindow 这个是啥呢?...那就到里PhoneWindow面看一下 getDecorView()是如何实现的 PhoneWindow.java: @Override public final View getDecorView...().findViewById(id); } public abstract View getDecorView(); } getDecorView的具体实现又回到了PhoneWindow...中; @Override public final View getDecorView() { if (mDecor == null || mForceDecorInstall
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (hideStatusBarBackground) { window.getDecorView...View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); } else { window.getDecorView...WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(Color.TRANSPARENT); window.getDecorView...window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.getDecorView...getStatusBarHeight(Activity activity) { Rect frame = new Rect(); activity.getWindow().getDecorView
public static Bitmap snapShotWithStatusBar(Activity activity) { View view = activity.getWindow().getDecorView...static Bitmap snapShotWithoutStatusBar(Activity activity) { View view = activity.getWindow().getDecorView...Bitmap bmp = view.getDrawingCache(); Rect frame = new Rect(); activity.getWindow().getDecorView
hideSoftInputFromWindow (IBinder windowToken, int flags) windowToken:第一个参数可以使用View.getWindowToken()或者getWindow().getDecorView...().getWindowToken() flags:隐藏软键盘的标志位,可以传0 关闭软键盘,windowToken不需要已获取焦点的View,所以可以使用getWindow().getDecorView...= null) { imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0); } 注意:如果是使用
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); window.getDecorView...WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); window.getDecorView...WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); window.getDecorView
Build.VERSION_CODES.M) { StatusBarUtil.transparencyBar(this);//设置全透明 getWindow().getDecorView...WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); window.getDecorView...} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { activity.getWindow().getDecorView...FlymeSetStatusBarLightMode(activity.getWindow(), true); } else if (type == 3) { activity.getWindow().getDecorView...FlymeSetStatusBarLightMode(activity.getWindow(), false); } else if (type == 3) { activity.getWindow().getDecorView
savedInstanceState); setContentView(R.layout.activity_main); View decorView = getWindow().getDecorView...ActionBar actionBar = getSupportActionBar(); actionBar.hide(); } } 这里先调用getWindow().getDecorView...setContentView(R.layout.activity_main); if (Build.VERSION.SDK_INT >= 21) { View decorView = getWindow().getDecorView...super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); View decorView = getWindow().getDecorView...hasFocus); if (hasFocus && Build.VERSION.SDK_INT >= 19) { View decorView = getWindow().getDecorView
public KeyboardStatusDetector registerActivity(Activity a) { return registerView(a.getWindow().getDecorView...NewsDetailsActivity.this); } //设置处于底部 sendMsgPopup.showAtLocation(getWindow().getDecorView
这里先说明现象 1.内容布局全屏 在 Android 4.1 以上设置去除状态栏或者认为是状态栏被内容布局遮挡了(全屏)和去除 ActionBar View decorView = getWindow().getDecorView...2.内容布局全屏(被状态栏遮住顶部) View decorView = getWindow().getDecorView(); int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN...hasFocus); if (hasFocus && Build.VERSION.SDK_INT >=19){ View decorView = getWindow().getDecorView...类似于 getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | LAYOUT_STABLE.../colorAccent 对应状态栏颜色 修改状态栏文字颜色 关于状态栏的文字颜色,是在 Android 6.0 才开始可以支持修改的 // 修改成 黑色字体 getWindow().getDecorView
takeScreenShot(Activity activity) { // View是你需要截图的View View view = activity.getWindow().getDecorView...view.getDrawingCache(); // 获取状态栏高度 Rect frame = new Rect(); activity.getWindow().getDecorView
(Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { View v = this.getWindow().getDecorView...View.GONE); } else if (Build.VERSION.SDK_INT >= 19) { View decorView = getWindow().getDecorView...Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api View v = this.getWindow().getDecorView...View decorView =this.getWindow().getDecorView(); decorView.setSystemUiVisibility(
方式一 public static Bitmap capture(Activity activity) { activity.getWindow().getDecorView().setDrawingCacheEnabled...(true); Bitmap bmp = activity.getWindow().getDecorView().getDrawingCache(); return bmp
Android截屏的几种实现 ##方式一 public static Bitmap capture(Activity activity) { activity.getWindow().getDecorView...().setDrawingCacheEnabled(true); Bitmap bmp = activity.getWindow().getDecorView().getDrawingCache
android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { getSupportActionBar().hide(); getWindow().getDecorView...WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; //设置页面延伸到凹口区显示 getWindow().setAttributes(lp); getWindow().getDecorView...null 如下设置全屏使用凹口屏时要注意 View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN,否则参数很有可能获取不到; getWindow().getDecorView
领取专属 10元无门槛券
手把手带您无忧上云