当前位置: 首页>>代码示例>>Java>>正文


Java Window.setNavigationBarColor方法代码示例

本文整理汇总了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);
            }
        }


    }
 
开发者ID:ifadai,项目名称:AndroidThemeChange,代码行数:23,代码来源:ThemeUtils.java

示例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);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:StatusBarUtil.java

示例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);
    }
}
 
开发者ID:ls1110924,项目名称:ImmerseMode,代码行数:22,代码来源:TpSbTlNbwFCImmerseMode.java

示例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);
    }
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:21,代码来源:ATE.java

示例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);
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:22,代码来源:TransStatusBar.java

示例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));
	}

}
 
开发者ID:ivybao0628,项目名称:MorseKnown,代码行数:37,代码来源:MainActivity.java

示例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();
    }
}
 
开发者ID:miradilabk,项目名称:UyghurWeather,代码行数:13,代码来源:StatusBarUtils.java

示例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指示器的颜色
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:PaletteActivity2.java

示例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);
    }
}
 
开发者ID:yanzhenjie,项目名称:Sofia,代码行数:11,代码来源:Utils.java

示例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);
    }
}
 
开发者ID:yanzhenjie,项目名称:Sofia,代码行数:13,代码来源:Utils.java

示例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);
    }
}
 
开发者ID:shenhuanet,项目名称:PCController-android,代码行数:15,代码来源:BaseActivity.java

示例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();
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:30,代码来源:MainActivity.java

示例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);
    }
}
 
开发者ID:SiberiaDante,项目名称:TitleLayout,代码行数:19,代码来源:ScreenUtil.java

示例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);
    }
}
 
开发者ID:Trumeet,项目名称:SetupWizardLibCompat,代码行数:19,代码来源:SystemBarHelper.java

示例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);
        }
    }
}
 
开发者ID:WeiXinqiao,项目名称:Recognize-it,代码行数:17,代码来源:AlbumFolderDialog.java


注:本文中的android.view.Window.setNavigationBarColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。