// 修改导航栏颜色getWindow().setNavigationBarColor(Color.RED);// 将导航栏颜色改为红色 1. 2. 在Dialog 打开前,如果需要在Dialog被关闭以后的事件中,还原导航栏颜色,我们可以创建一个标签来记录当前的颜色。 // 记录当前导航栏颜色intcurrentNavBarColor=getWindow().getNavigationBarColor();// 获取当前颜色...
privatevoidsetNavigationBarColor(intcolor){Windowwindow=getWindow();// 获取当前窗口if(window!=null){window.setNavigationBarColor(color);// 设置导航栏颜色}} 1. 2. 3. 4. 5. 6. 4. 在显示 Dialog 时调用设置导航栏颜色的方法 最后,我们需要在显示 Dialog 之前设置导航栏的颜色。确保在弹出 Dialog ...
overridevalimmersiveDialogConfigget()=ImmersiveDialogConfig.createFullScreenDialogConfig().apply{height=500// 可选:设置弹窗高度navigationColor=Color.BLACK//可选:设置底部导航栏背景为黑色isLightNavigationBarForegroundColor=true//可选:设置设置底部导航栏上的图标为白色} 常用案例三:带输入框同时需要弹出键盘时自...
Window window = dialog.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(dialog.getContext().getResources().getColor(colorResId)); //底部导航栏 //window.setNavigationBarColor(activity.getResources().getColor(colorResId)); } }catch ...
设置activity为Dialog <stylename="TestTheme"parent="@style/Theme.AppCompat.Light.NoActionBar"><!-- 设置dialog背景为黑色#00000000--><!-- <item name="android:windowBackground">@android:color/transparent</item>--><itemname="android:windowNoTitle">true</item><!-- 是否悬浮--><itemname="andro...
public class WatchMessagePictureDialog extends AlertDialog { private RelativeLayout rl_pager; private ViewPager viewPager; private ImageView iv_actionbar_menu; private ImageView iv_video; private ImageView iv_download; private TextView tv_index;
android 4.4以上沉浸式状态栏和沉浸式导航栏管理,适配横竖屏切换、刘海屏、软键盘弹出等问题,可以修改状态栏字体颜色和导航栏图标颜色,以及不可修改字体颜色手机的适配,适用于Activity、Fragment、DialogFragment、Dialog,PopupWindow,一句代码轻松实现,以及对bar的
android 4.4以上沉浸式状态栏和沉浸式导航栏管理,适配横竖屏切换、刘海屏、软键盘弹出等问题,可以修改状态栏字体颜色和导航栏图标颜色,以及不可修改字体颜色手机的适配,适用于Activity、Fragment、DialogFragment、Dialog,PopupWindow,一句代码轻松实现,以及对bar的
一个app全局只使用一种状态栏颜色,这只是一个美好的愿望。 实际项目十分蛋疼,各种activity都需要各种颜色的状态栏。我们可以创建一个新的主题改变colorPrimaryDark颜色后,给这个activity使用。代码如下: styles.xml <!--Base application theme.--><stylename="AppTheme"parent="Theme.AppCompat.Light.DarkActionBar"...
privatevoidshowDialog2(){AlertDialogmDialog=newAlertDialog.Builder(MainActivity.this).setTitle("标题").setMessage("这个是什么呢?").setPositiveButton(R.string.sure,null).setNegativeButton(R.string.cancel,null).show();// 修改弹窗的背景颜色mDialog.getWindow().setBackgroundDrawableResource(R.color.purp...