本文整理汇总了Java中android.view.Window.setNavigationBarColor方法的典型用法代码示例。如果您正苦于以下问题:Java Window.setNavigationBarColor方法的具体用法?Java Window.setNavigationBarColor怎么用?Java Window.setNavigationBarColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.Window
的用法示例。
在下文中一共展示了Window.setNavigationBarColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setWindowStatusBarColor
import android.view.Window; //导入方法依赖的package包/类
/**
* 当前页面设置状态栏颜色
*
* */
public static void setWindowStatusBarColor(Activity activity, int color){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
View view=contentView.getChildAt(1);
view.setBackgroundColor(color);
} else {
Window window=activity.getWindow();
if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.LOLLIPOP){
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// 状态栏
window.setStatusBarColor(color);
// 底部导航栏
window.setNavigationBarColor(color);
}
}
}
示例2: setImgTransparent
import android.view.Window; //导入方法依赖的package包/类
public static void setImgTransparent(Activity activity){
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
}
}
示例3: TpSbTlNbwFCImmerseMode
import android.view.Window; //导入方法依赖的package包/类
public TpSbTlNbwFCImmerseMode(@NonNull Activity activity) {
mActivityRef = new SoftReference<>(activity);
Window window = activity.getWindow();
WindowUtils.clearWindowFlags(window, FLAG_TRANSLUCENT_STATUS);
WindowUtils.addWindowFlags(window, FLAG_TRANSLUCENT_NAVIGATION);
WindowUtils.addWindowFlags(window, FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.getDecorView().setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_STABLE | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
mActivityConfig = new ActivityConfig(activity);
mCompatStatusBarView = setupContentViewAndStatusBarView(activity);
mCompatNavigationBarView = setupNavigationBarView(activity);
window.setStatusBarColor(Color.TRANSPARENT);
mCompatStatusBarView.setBackgroundColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
if (mCompatNavigationBarView != null) {
mCompatNavigationBarView.setBackgroundColor(Color.TRANSPARENT);
}
}
示例4: performMainTheming
import android.view.Window; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static void performMainTheming(@NonNull Activity activity, @Nullable String key) {
final View rootView = getRootView(activity);
final boolean rootSetsStatusBarColor = rootView != null && rootView instanceof ViewInterface &&
((ViewInterface) rootView).setsStatusBarColor();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
final Window window = activity.getWindow();
if (!rootSetsStatusBarColor) {
if (Config.coloredStatusBar(activity, key))
window.setStatusBarColor(Config.statusBarColor(activity, key));
else window.setStatusBarColor(Color.BLACK);
invalidateLightStatusBar(activity, key);
}
if (Config.coloredNavigationBar(activity, key))
window.setNavigationBarColor(Config.navigationBarColor(activity, key));
else window.setNavigationBarColor(Color.BLACK);
applyTaskDescription(activity, key);
}
}
示例5: set
import android.view.Window; //导入方法依赖的package包/类
public static void set(Activity activity){
int SDK_CODE = Build.VERSION.SDK_INT;
if(SDK_CODE >= 19 && SDK_CODE<21) {
//透明状态栏
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
//透明导航栏
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
if(Build.VERSION.SDK_INT >= 21) {
Window window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
}
}
示例6: onCreate
import android.view.Window; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//创建资源
rc = new ResourcesCompat();
//创建FRAGMENT 添加tab
pager = new Pager(getSupportFragmentManager());
//得到VIEWPAGER
viewPager = (ViewPager)findViewById(R.id.view_pager);
viewPager.setAdapter(pager);
//把TAB 添加到TabLayout上
TabLayout tabLayout = (TabLayout)findViewById(R.id.tab_layout);
//设置tab显示的内容
tabLayout.setupWithViewPager(viewPager);
tabLayout.getTabAt(0).setText("闪光灯编码");
tabLayout.getTabAt(3).setText("闪光灯解码");
tabLayout.getTabAt(2).setText("参数设置 ");
tabLayout.getTabAt(1).setText("对照表 ");
tabLayout.getTabAt(4).setText("关于我们");
viewPager.setOffscreenPageLimit(0);
//添加导航条颜色
if(Build.VERSION.SDK_INT >= CUSTOM_TOP_BAR_COLOR_API){
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(rc.getColor(getResources(), R.color.bold, null));
window.setNavigationBarColor(rc.getColor(getResources(), R.color.dull, null));
}
}
示例7: setWindowStatusBarColor
import android.view.Window; //导入方法依赖的package包/类
public static void setWindowStatusBarColor(Activity activity, int colorResId) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(ContextCompat.getColor(activity, colorResId));
window.setNavigationBarColor(ContextCompat.getColor(activity, colorResId));
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例8: setColor
import android.view.Window; //导入方法依赖的package包/类
/**
* 设置颜色
* @param vibrant
*/
private void setColor(Palette.Swatch vibrant) {
// 将颜色设置给状态栏
if (android.os.Build.VERSION.SDK_INT >= 21) {
Window window = getWindow();
window.setStatusBarColor(deepenColor(vibrant.getRgb()));//设置状态栏的颜色,设置颜色之前对颜色进行加深处理
window.setNavigationBarColor(deepenColor(vibrant.getRgb()));//设置导航栏的颜色,设置颜色之前对颜色进行加深处理
}
mToolbar.setBackgroundColor(vibrant.getRgb());//设置Toolbar背景色
mTabLayout.setBackgroundColor(vibrant.getRgb());//设置TabLayout背景色
mTabLayout.setSelectedTabIndicatorColor(deepenColor(vibrant.getRgb()));//设置TabLayout指示器的颜色
}
示例9: setNavigationBarColor
import android.view.Window; //导入方法依赖的package包/类
/**
* Set the navigation bar color.
*/
public static void setNavigationBarColor(Activity activity, int navigationBarColor) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setNavigationBarColor(navigationBarColor);
}
}
示例10: invasionNavigationBar
import android.view.Window; //导入方法依赖的package包/类
/**
* Set the content layout full the NavigationBar, but do not hide NavigationBar.
*/
public static void invasionNavigationBar(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
View decorView = window.getDecorView();
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setNavigationBarColor(Color.TRANSPARENT);
}
}
示例11: initFitsWindow
import android.view.Window; //导入方法依赖的package包/类
private void initFitsWindow() {
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
}
}
示例12: onCreate
import android.view.Window; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
}
setContentView(R.layout.activity_main);
findView();
initView();
initRvRing();
initRvCheckOut();
effects = getResources().getStringArray(R.array.jazzy_effects);
setupJazziness(JazzyViewPager.TransitionEffect.valueOf(effects[index]));
initScrollView();
initFAB();
initBlur();
}
示例13: setFullScreen
import android.view.Window; //导入方法依赖的package包/类
/**
* 设置全屏
*
* @param activity
*/
public static void setFullScreen(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
}
}
示例14: hideSystemBars
import android.view.Window; //导入方法依赖的package包/类
/**
* Hide the navigation bar for a dialog.
*
* <p>This will only take effect in versions Lollipop or above. Otherwise this is a no-op.
*/
public static void hideSystemBars(final Dialog dialog) {
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
final Window window = dialog.getWindow();
temporarilyDisableDialogFocus(window);
addVisibilityFlag(window, DIALOG_IMMERSIVE_FLAGS);
addImmersiveFlagsToDecorView(window, DIALOG_IMMERSIVE_FLAGS);
// Also set the navigation bar and status bar to transparent color. Note that this
// doesn't work if android.R.boolean.config_enableTranslucentDecor is false.
window.setNavigationBarColor(0);
window.setStatusBarColor(0);
}
}
示例15: setWindowBarColor
import android.view.Window; //导入方法依赖的package包/类
/**
* Set window bar color.
*
* @param statusColor status bar color.
* @param navigationColor navigation bar color.
*/
private void setWindowBarColor(@ColorInt int statusColor, @ColorInt int navigationColor) {
if (Build.VERSION.SDK_INT >= 21) {
final Window window = getWindow();
if (window != null) {
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(statusColor);
window.setNavigationBarColor(navigationColor);
}
}
}