纯抄的,记录学习,感谢原文作者

原文:https://www.jianshu.com/p/5a54b2c3ea05

Android 4.4(API 19)之后,就提供了修改状态栏颜色的方法,但是在 Android 6.0(API 23)之后,才支持修改状态栏上面的文字和图标颜色,默认是白色的。有一些第三方的系统提供了设置状态栏和状态栏文字、图标颜色的方法,比如小米的MIUI和魅族的Flyme OS。

/*** 状态栏工具类* Author: @Catherine*/
public class StatusBarUtil {/*** 设置状态栏为透明* @param activity*/@TargetApi(19)public static void setTranslucentStatus(Activity activity) {if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {Window window = activity.getWindow();window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);window.setStatusBarColor(Color.TRANSPARENT);} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {Window window = activity.getWindow();window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);}}/*** 修改状态栏颜色,支持4.4以上版本* @param activity* @param colorId*/public static void setStatusBarColor(Activity activity, int colorId) {//Android6.0(API 23)以上,系统方法if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {Window window = activity.getWindow();window.setStatusBarColor(activity.getResources().getColor(colorId));} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//使用SystemBarTint库使4.4版本状态栏变色,需要先将状态栏设置为透明setTranslucentStatus(activity);//设置状态栏颜色SystemBarTintManager tintManager = new SystemBarTintManager(activity);tintManager.setStatusBarTintEnabled(true);tintManager.setStatusBarTintResource(colorId);}}/*** 设置状态栏模式* @param activity* @param isTextDark 文字、图标是否为黑色 (false为默认的白色)* @param colorId 状态栏颜色* @return*/public static void setStatusBarMode(Activity activity, boolean isTextDark, int colorId) {//修改状态栏颜色和文字图标颜色setStatusBarColor(activity, colorId);//4.4以上才可以改文字图标颜色if(OSUtil.isMIUI()) {//小米MIUI系统setMIUIStatusBarTextMode(activity, isTextDark);} else if(OSUtil.isFlyme()) {//魅族flyme系统setFlymeStatusBarTextMode(activity, isTextDark);} else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {//6.0以上,调用系统方法Window window = activity.getWindow();window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);if (isTextDark) {window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);}} else {//4.4以上6.0以下的其他系统,暂时没有修改状态栏的文字图标颜色的方法,有可以加上}}/*** 设置Flyme系统状态栏的文字图标颜色* @param activity* @param isDark 状态栏文字及图标是否为深色* @return*/public static boolean setFlymeStatusBarTextMode(Activity activity, boolean isDark) {Window window = activity.getWindow();boolean result = false;if (window != null) {try {WindowManager.LayoutParams lp = window.getAttributes();Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags");darkFlag.setAccessible(true);meizuFlags.setAccessible(true);int bit = darkFlag.getInt(null);int value = meizuFlags.getInt(lp);if (isDark) {value |= bit;} else {value &= ~bit;}meizuFlags.setInt(lp, value);window.setAttributes(lp);result = true;} catch (Exception e) {}}return result;}/*** 设置MIUI系统状态栏的文字图标颜色(MIUIV6以上)* @param activity* @param isDark 状态栏文字及图标是否为深色* @return*/public static boolean setMIUIStatusBarTextMode(Activity activity, boolean isDark) {boolean result = false;Window window = activity.getWindow();if (window != null) {Class clazz = window.getClass();try {int darkModeFlag = 0;Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");darkModeFlag = field.getInt(layoutParams);Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);if (isDark) {extraFlagField.invoke(window, darkModeFlag, darkModeFlag);//状态栏透明且黑色字体} else {extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体}result = true;if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {//开发版 7.7.13 及以后版本采用了系统API,旧方法无效但不会报错,所以两个方式都要加上if (isDark) {activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);} else {activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);}}} catch (Exception e) {}}return result;}
}/*** 设备系统工具类* Author: @Catherine*/
public class OSUtil {//MIUI标识private static final String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code";private static final String KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name";private static final String KEY_MIUI_INTERNAL_STORAGE = "ro.miui.internal.storage";//EMUI标识private static final String KEY_EMUI_VERSION_CODE = "ro.build.version.emui";private static final String KEY_EMUI_API_LEVEL = "ro.build.hw_emui_api_level";private static final String KEY_EMUI_CONFIG_HW_SYS_VERSION = "ro.confg.hw_systemversion";//Flyme标识private static final String KEY_FLYME_ID_FALG_KEY = "ro.build.display.id";private static final String KEY_FLYME_ID_FALG_VALUE_KEYWORD = "Flyme";private static final String KEY_FLYME_ICON_FALG = "persist.sys.use.flyme.icon";private static final String KEY_FLYME_SETUP_FALG = "ro.meizu.setupwizard.flyme";private static final String KEY_FLYME_PUBLISH_FALG = "ro.flyme.published";/*** 是否是Flyme系统* @return*/public static boolean isFlyme() {if(isPropertiesExist(KEY_FLYME_ICON_FALG, KEY_FLYME_SETUP_FALG, KEY_FLYME_PUBLISH_FALG)) {return true;}try {BuildProperties buildProperties = BuildProperties.newInstance();if(buildProperties.containsKey(KEY_FLYME_ID_FALG_KEY)) {String romName = buildProperties.getProperty(KEY_FLYME_ID_FALG_KEY);if (!StrUtils.isEmpty(romName) && romName.contains(KEY_FLYME_ID_FALG_VALUE_KEYWORD)) {return true;}}} catch (IOException e) {e.printStackTrace();}return false;}/*** 是否是EMUI系统* @return*/public static boolean isEMUI() {return isPropertiesExist(KEY_EMUI_VERSION_CODE, KEY_EMUI_API_LEVEL,KEY_EMUI_CONFIG_HW_SYS_VERSION);}/*** 是否是MIUI系统* @return*/public static boolean isMIUI() {return isPropertiesExist(KEY_MIUI_VERSION_CODE, KEY_MIUI_VERSION_NAME,KEY_MIUI_INTERNAL_STORAGE);}private static boolean isPropertiesExist(String... keys) {if (keys == null || keys.length == 0) {return false;}try {BuildProperties properties = BuildProperties.newInstance();for (String key : keys) {String value = properties.getProperty(key);if (value != null)return true;}return false;} catch (IOException e) {return false;}}private static final class BuildProperties {private final Properties properties;private BuildProperties() throws IOException {properties = new Properties();// 读取系统配置信息build.prop类properties.load(new FileInputStream(new File(Environment.getRootDirectory(), "build" +".prop")));}public boolean containsKey(final Object key) {return properties.containsKey(key);}public boolean containsValue(final Object value) {return properties.containsValue(value);}public Set<Map.Entry<Object, Object>> entrySet() {return properties.entrySet();}public String getProperty(final String name) {return properties.getProperty(name);}public String getProperty(final String name, final String defaultValue) {return properties.getProperty(name, defaultValue);}public boolean isEmpty() {return properties.isEmpty();}public Enumeration<Object> keys() {return properties.keys();}public Set<Object> keySet() {return properties.keySet();}public int size() {return properties.size();}public Collection<Object> values() {return properties.values();}public static BuildProperties newInstance() throws IOException {return new BuildProperties();}}
}

下面这个SystemBarTintManager类是从'com.readystatesoftware.systembartint:systembartint:1.0.3'copy出来的,如果不想copy可以直接依赖。

public class SystemBarTintManager {static {// Android allows a system property to override the presence of the navigation bar.// Used by the emulator.// See https://github.com/android/platform_frameworks_base/blob/master/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java#L1076if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {try {Class c = Class.forName("android.os.SystemProperties");Method m = c.getDeclaredMethod("get", String.class);m.setAccessible(true);sNavBarOverride = (String) m.invoke(null, "qemu.hw.mainkeys");} catch (Throwable e) {sNavBarOverride = null;}}}/*** The default system bar tint color value.*/public static final int DEFAULT_TINT_COLOR = 0x99000000;private static String sNavBarOverride;private final SystemBarConfig mConfig;private boolean mStatusBarAvailable;private boolean mNavBarAvailable;private boolean mStatusBarTintEnabled;private boolean mNavBarTintEnabled;private View mStatusBarTintView;private View mNavBarTintView;/*** Constructor. Call this in the host activity onCreate method after its* content view has been set. You should always create new instances when* the host activity is recreated.** @param activity The host activity.*/@TargetApi(19)public SystemBarTintManager(Activity activity) {Window win = activity.getWindow();ViewGroup decorViewGroup = (ViewGroup) win.getDecorView();if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {// check theme attrsint[] attrs = {android.R.attr.windowTranslucentStatus,android.R.attr.windowTranslucentNavigation};TypedArray a = activity.obtainStyledAttributes(attrs);try {mStatusBarAvailable = a.getBoolean(0, false);mNavBarAvailable = a.getBoolean(1, false);} finally {a.recycle();}// check window flagsWindowManager.LayoutParams winParams = win.getAttributes();int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;if ((winParams.flags & bits) != 0) {mStatusBarAvailable = true;}bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;if ((winParams.flags & bits) != 0) {mNavBarAvailable = true;}}mConfig = new SystemBarConfig(activity, mStatusBarAvailable, mNavBarAvailable);// device might not have virtual navigation keysif (!mConfig.hasNavigtionBar()) {mNavBarAvailable = false;}if (mStatusBarAvailable) {setupStatusBarView(activity, decorViewGroup);}if (mNavBarAvailable) {setupNavBarView(activity, decorViewGroup);}}/*** Enable tinting of the system status bar.** If the platform is running Jelly Bean or earlier, or translucent system* UI modes have not been enabled in either the theme or via window flags,* then this method does nothing.** @param enabled True to enable tinting, false to disable it (default).*/public void setStatusBarTintEnabled(boolean enabled) {mStatusBarTintEnabled = enabled;if (mStatusBarAvailable) {mStatusBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);}}/*** Enable tinting of the system navigation bar.** If the platform does not have soft navigation keys, is running Jelly Bean* or earlier, or translucent system UI modes have not been enabled in either* the theme or via window flags, then this method does nothing.** @param enabled True to enable tinting, false to disable it (default).*/public void setNavigationBarTintEnabled(boolean enabled) {mNavBarTintEnabled = enabled;if (mNavBarAvailable) {mNavBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);}}/*** Apply the specified color tint to all system UI bars.** @param color The color of the background tint.*/public void setTintColor(int color) {setStatusBarTintColor(color);setNavigationBarTintColor(color);}/*** Apply the specified drawable or color resource to all system UI bars.** @param res The identifier of the resource.*/public void setTintResource(int res) {setStatusBarTintResource(res);setNavigationBarTintResource(res);}/*** Apply the specified drawable to all system UI bars.** @param drawable The drawable to use as the background, or null to remove it.*/public void setTintDrawable(Drawable drawable) {setStatusBarTintDrawable(drawable);setNavigationBarTintDrawable(drawable);}/*** Apply the specified alpha to all system UI bars.** @param alpha The alpha to use*/public void setTintAlpha(float alpha) {setStatusBarAlpha(alpha);setNavigationBarAlpha(alpha);}/*** Apply the specified color tint to the system status bar.** @param color The color of the background tint.*/public void setStatusBarTintColor(int color) {if (mStatusBarAvailable) {mStatusBarTintView.setBackgroundColor(color);}}/*** Apply the specified drawable or color resource to the system status bar.** @param res The identifier of the resource.*/public void setStatusBarTintResource(int res) {if (mStatusBarAvailable) {mStatusBarTintView.setBackgroundResource(res);}}/*** Apply the specified drawable to the system status bar.** @param drawable The drawable to use as the background, or null to remove it.*/@SuppressWarnings("deprecation")public void setStatusBarTintDrawable(Drawable drawable) {if (mStatusBarAvailable) {mStatusBarTintView.setBackgroundDrawable(drawable);}}/*** Apply the specified alpha to the system status bar.** @param alpha The alpha to use*/@TargetApi(11)public void setStatusBarAlpha(float alpha) {if (mStatusBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {mStatusBarTintView.setAlpha(alpha);}}/*** Apply the specified color tint to the system navigation bar.** @param color The color of the background tint.*/public void setNavigationBarTintColor(int color) {if (mNavBarAvailable) {mNavBarTintView.setBackgroundColor(color);}}/*** Apply the specified drawable or color resource to the system navigation bar.** @param res The identifier of the resource.*/public void setNavigationBarTintResource(int res) {if (mNavBarAvailable) {mNavBarTintView.setBackgroundResource(res);}}/*** Apply the specified drawable to the system navigation bar.** @param drawable The drawable to use as the background, or null to remove it.*/@SuppressWarnings("deprecation")public void setNavigationBarTintDrawable(Drawable drawable) {if (mNavBarAvailable) {mNavBarTintView.setBackgroundDrawable(drawable);}}/*** Apply the specified alpha to the system navigation bar.** @param alpha The alpha to use*/@TargetApi(11)public void setNavigationBarAlpha(float alpha) {if (mNavBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {mNavBarTintView.setAlpha(alpha);}}/*** Get the system bar configuration.** @return The system bar configuration for the current device configuration.*/public SystemBarConfig getConfig() {return mConfig;}/*** Is tinting enabled for the system status bar?** @return True if enabled, False otherwise.*/public boolean isStatusBarTintEnabled() {return mStatusBarTintEnabled;}/*** Is tinting enabled for the system navigation bar?** @return True if enabled, False otherwise.*/public boolean isNavBarTintEnabled() {return mNavBarTintEnabled;}private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {mStatusBarTintView = new View(context);FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());params.gravity = Gravity.TOP;if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {params.rightMargin = mConfig.getNavigationBarWidth();}mStatusBarTintView.setLayoutParams(params);mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);mStatusBarTintView.setVisibility(View.GONE);decorViewGroup.addView(mStatusBarTintView);}private void setupNavBarView(Context context, ViewGroup decorViewGroup) {mNavBarTintView = new View(context);FrameLayout.LayoutParams params;if (mConfig.isNavigationAtBottom()) {params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, mConfig.getNavigationBarHeight());params.gravity = Gravity.BOTTOM;} else {params = new FrameLayout.LayoutParams(mConfig.getNavigationBarWidth(), FrameLayout.LayoutParams.MATCH_PARENT);params.gravity = Gravity.RIGHT;}mNavBarTintView.setLayoutParams(params);mNavBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);mNavBarTintView.setVisibility(View.GONE);decorViewGroup.addView(mNavBarTintView);}/*** Class which describes system bar sizing and other characteristics for the current* device configuration.**/public static class SystemBarConfig {private static final String STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height";private static final String NAV_BAR_HEIGHT_RES_NAME = "navigation_bar_height";private static final String NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME = "navigation_bar_height_landscape";private static final String NAV_BAR_WIDTH_RES_NAME = "navigation_bar_width";private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar";private final boolean mTranslucentStatusBar;private final boolean mTranslucentNavBar;private final int mStatusBarHeight;private final int mActionBarHeight;private final boolean mHasNavigationBar;private final int mNavigationBarHeight;private final int mNavigationBarWidth;private final boolean mInPortrait;private final float mSmallestWidthDp;private SystemBarConfig(Activity activity, boolean translucentStatusBar, boolean traslucentNavBar) {Resources res = activity.getResources();mInPortrait = (res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);mSmallestWidthDp = getSmallestWidthDp(activity);mStatusBarHeight = getInternalDimensionSize(res, STATUS_BAR_HEIGHT_RES_NAME);mActionBarHeight = getActionBarHeight(activity);mNavigationBarHeight = getNavigationBarHeight(activity);mNavigationBarWidth = getNavigationBarWidth(activity);mHasNavigationBar = (mNavigationBarHeight > 0);mTranslucentStatusBar = translucentStatusBar;mTranslucentNavBar = traslucentNavBar;}@TargetApi(14)private int getActionBarHeight(Context context) {int result = 0;if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {TypedValue tv = new TypedValue();context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);result = context.getResources().getDimensionPixelSize(tv.resourceId);}return result;}@TargetApi(14)private int getNavigationBarHeight(Context context) {Resources res = context.getResources();int result = 0;if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {if (hasNavBar(context)) {String key;if (mInPortrait) {key = NAV_BAR_HEIGHT_RES_NAME;} else {key = NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME;}return getInternalDimensionSize(res, key);}}return result;}@TargetApi(14)private int getNavigationBarWidth(Context context) {Resources res = context.getResources();int result = 0;if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {if (hasNavBar(context)) {return getInternalDimensionSize(res, NAV_BAR_WIDTH_RES_NAME);}}return result;}@TargetApi(14)private boolean hasNavBar(Context context) {Resources res = context.getResources();int resourceId = res.getIdentifier(SHOW_NAV_BAR_RES_NAME, "bool", "android");if (resourceId != 0) {boolean hasNav = res.getBoolean(resourceId);// check override flag (see static block)if ("1".equals(sNavBarOverride)) {hasNav = false;} else if ("0".equals(sNavBarOverride)) {hasNav = true;}return hasNav;} else { // fallbackreturn !ViewConfiguration.get(context).hasPermanentMenuKey();}}private int getInternalDimensionSize(Resources res, String key) {int result = 0;int resourceId = res.getIdentifier(key, "dimen", "android");if (resourceId > 0) {result = res.getDimensionPixelSize(resourceId);}return result;}@SuppressLint("NewApi")private float getSmallestWidthDp(Activity activity) {DisplayMetrics metrics = new DisplayMetrics();if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);} else {// TODO this is not correct, but we don't really care pre-kitkatactivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);}float widthDp = metrics.widthPixels / metrics.density;float heightDp = metrics.heightPixels / metrics.density;return Math.min(widthDp, heightDp);}/*** Should a navigation bar appear at the bottom of the screen in the current* device configuration? A navigation bar may appear on the right side of* the screen in certain configurations.** @return True if navigation should appear at the bottom of the screen, False otherwise.*/public boolean isNavigationAtBottom() {return (mSmallestWidthDp >= 600 || mInPortrait);}/*** Get the height of the system status bar.** @return The height of the status bar (in pixels).*/public int getStatusBarHeight() {return mStatusBarHeight;}/*** Get the height of the action bar.** @return The height of the action bar (in pixels).*/public int getActionBarHeight() {return mActionBarHeight;}/*** Does this device have a system navigation bar?** @return True if this device uses soft key navigation, False otherwise.*/public boolean hasNavigtionBar() {return mHasNavigationBar;}/*** Get the height of the system navigation bar.** @return The height of the navigation bar (in pixels). If the device does not have* soft navigation keys, this will always return 0.*/public int getNavigationBarHeight() {return mNavigationBarHeight;}/*** Get the width of the system navigation bar when it is placed vertically on the screen.** @return The width of the navigation bar (in pixels). If the device does not have* soft navigation keys, this will always return 0.*/public int getNavigationBarWidth() {return mNavigationBarWidth;}/*** Get the layout inset for any system UI that appears at the top of the screen.** @param withActionBar True to include the height of the action bar, False otherwise.* @return The layout inset (in pixels).*/public int getPixelInsetTop(boolean withActionBar) {return (mTranslucentStatusBar ? mStatusBarHeight : 0) + (withActionBar ? mActionBarHeight : 0);}/*** Get the layout inset for any system UI that appears at the bottom of the screen.** @return The layout inset (in pixels).*/public int getPixelInsetBottom() {if (mTranslucentNavBar && isNavigationAtBottom()) {return mNavigationBarHeight;} else {return 0;}}/*** Get the layout inset for any system UI that appears at the right of the screen.** @return The layout inset (in pixels).*/public int getPixelInsetRight() {if (mTranslucentNavBar && !isNavigationAtBottom()) {return mNavigationBarWidth;} else {return 0;}}}}

使用:

/*** 参数1  activity: this即可* 参数2  isTextDark: true -- 设置黑色字体;false -- 设置白色字体* 参数3  colorId: int color 设置状态栏背景颜色*/
StatusBarUtil.setStatusBarMode(this, false, R.color.black);

作者:来了一年多的Catherine
链接:https://www.jianshu.com/p/5a54b2c3ea05
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

Android 设置状态栏背景颜色和状态栏文字、图标颜色相关推荐

  1. android edittext背景颜色,Android 设置 EditText 背景颜色、背景图片

    Android 设置 EditText 背景颜色mView.findViewById(R.id.editText).setBackgroundResource(R.color.caution); An ...

  2. i css svg,如何设置 CSS 背景图中的 SVG 的颜色

    Coloring SVGs in CSS Background Images 如何设置 CSS 背景图中的 SVG 的颜色 I love using SVG in CSS background ima ...

  3. 设置eclipse中的编辑区的背景颜色、注释文字的颜色、修改注释内作者名和时间

    1.编辑区的背景颜色修改按以下步骤: window-->preferences-->general-->Editors-->Text Editors   然后在appearan ...

  4. android 设置activity背景图片,给Activity设置背景颜色

    为了使得错误提示更加显眼,再用Toast+振动效果之外考虑变换整个activity的背景颜色. 尝试一: activity并没像winform一样直接给个属性来设置,就想获取整个activity的la ...

  5. android设置渐变背景,Android LinearLayout渐变背景

    我在将渐变背景应用于LinearLayout时遇到问题. 根据我所读的内容,这应该相对简单,但似乎不起作用. 作为参考,我正在开发2.1-update1. header_bg.xml: android ...

  6. android 桌面背景异常,android 设置桌面背景

    Android设置背景图片 2011-04-17 21:06:53 |  分类: 默认分类 | 字号 Android开发,设置背景图片 Android1.6运行通过 开发环境:NentBeans6.9 ...

  7. android设置window背景颜色,android – 设置标题背景颜色

    这个 thread将让你开始在xml文件中建立自己的标题栏,并在你的活动中使用它 编辑 这里是上面链接的内容的简要摘要 – 这只是设置文本的颜色和标题栏的背景 – 没有调整大小,没有按钮,只是最简单的 ...

  8. Android 设置系统SystemUI 顶部StatusBar状态栏透明一体化

    参考链接 http://blog.csdn.net/misly_vinky/article/details/12161075 这样修改的确能够把SystemUI StatusBar变成透明的但是有一个 ...

  9. android设置window背景颜色,Android WindowManager 背景暗化

    主要代码 WindowManager.LayoutParams.FLAG_DIM_BEHIND mParams.dimAmount = 0.5f; 示例 mWM = (WindowManager) c ...

  10. Android设置布局背景为白色的三种方法

    一.在xml文件里可以直接设置: android:background="#ffffff" 其他颜色可以看这里;http://blog.csdn.net/yanzi1225627/ ...

最新文章

  1. 金士顿固态硬盘计算机如何识别,金士顿SV300 SF2281固态硬盘SSD不认盘开卡修复教程...
  2. 【小虫虫】邮购笔记本的注意事项
  3. java 反射无参方法_java 反射 调用无参数方法?
  4. 曝华为Mate 50正在测试:有望搭载骁龙898旗舰芯
  5. 95-860-040-源码-定时器-SystemProcessingTimeService简介
  6. Eclipse中自动提示的方法参数都是arg0,arg1的解决方法
  7. 关于ASP.NET 将数据导出成Excel 的总结[下]
  8. robot framework -重点记录
  9. 如何用计算机测量图片景深,景深(摄影测量与遥感学术语 .)_百度百科
  10. 人工智能论文-人工智能技术在新冠病毒肺炎疫情防控中的应用
  11. 大数据相关面试题整理-带答案
  12. excel表格怎么换行?单元格内换行的4个方法
  13. 差劲的PHP后端开发,【后端开发】Php为什么性能差
  14. 如何提高外贸询单转化率
  15. 如何实现电脑远程操控西门子触摸屏画面
  16. 软件测试bug分析定位技巧
  17. 读取太阳紫外辐照谱数据
  18. 浪潮服务器开机板载卡显示FF,浪潮服务器安装操作系统简要步骤说明
  19. 长视频与短视频,其底层逻辑有何不同
  20. 搜狐智能媒体数据仓库体系建设实践

热门文章

  1. 牛客SQL练习-7-查找薪水变动超过15次的员工号emp_no以及其对应的变动次数t
  2. 邮件服务器http://jpk.sjzpc.edu.cn/yzx/wzgl/jxcgzs/syzd/17.htm
  3. 【习题答案】计网第三章_数据链路层
  4. 操作系统入门详解以及Linux介绍
  5. Linux基础:日志管理
  6. 影视剪辑,视频剪辑流程,如何进行混剪
  7. PHP是核心思路,模拟oicq的实现思路和核心程序(一) _php实例
  8. 14.K8S+KubeSphere+DevOps
  9. Arduino开源硬件-达芬奇-Level_1 (Mixly编程)
  10. E: The repository ‘http://ppa.launchpad.net/appimagelauncher-team/stable/ubuntu bionic Release‘ does