List of usage examples for android.view View setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:Main.java
public static void showToastView(Context context, String text) { Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT); View view = toast.getView(); view.setBackgroundColor(Color.GREEN); toast.setView(view);/*from ww w . j av a 2s.c o m*/ toast.show(); }
From source file:Main.java
public static void interweaveListViewBgColor(int position, View v) { if (position % 2 == 0) { v.setBackgroundColor(Color.WHITE); } else {/*from ww w . j a v a 2s. co m*/ v.setBackgroundColor(Color.LTGRAY); } }
From source file:Main.java
public static void setBackgroundColor(Context ctx, View view, boolean night, int lightResId, int darkResId) { view.setBackgroundColor(ctx.getResources().getColor(night ? darkResId : lightResId)); }
From source file:Main.java
public static void setFrameColor(View view, Integer integer) { if (integer != null) { view.setBackgroundColor(integer.intValue()); }/*from ww w .jav a 2s .c om*/ }
From source file:Main.java
public static void setViewBackgroundColor(View view, int i) { if (isValidInAppMessageColor(i)) { view.setBackgroundColor(i); }//from w w w. ja v a 2 s .c o m }
From source file:Main.java
/** * Sets custom title background colour,/*from w ww .ja v a 2 s. co m*/ * see http://stackoverflow.com/questions/2251714/set-title-background-color * @param colour */ public static void setApplicationTitleBackgroundColour(int colour, Activity activity) { View titleView = activity.getWindow().findViewById(android.R.id.title); if (titleView == null) { return; } ViewParent parent = titleView.getParent(); if (parent == null || !(parent instanceof View)) { return; } View parentView = (View) parent; parentView.setBackgroundColor(colour); }
From source file:Main.java
/** * Sets an alpha value on the view./*from w w w. ja v a 2s . c o m*/ */ public static void setAlphaOnViewBackground(View view, float alpha) { if (view != null) { view.setBackgroundColor((int) (clamp(alpha, 0.0f, 1.0f) * 255) << 24); } }
From source file:com.github.chenxiaolong.dualbootpatcher.SnackbarUtils.java
private static void snackbarSetBackgroundColor(Context context, Snackbar snackbar) { int colorResId; if (MainApplication.getUseDarkTheme()) { colorResId = R.color.snackbar_background_dark; } else {/*from w ww . ja va 2 s. c om*/ colorResId = R.color.snackbar_background_light; } View view = snackbar.getView(); view.setBackgroundColor(ContextCompat.getColor(context, colorResId)); }
From source file:Main.java
public static void setTransparent(Activity r, final View v) { r.runOnUiThread(new Runnable() { @Override//ww w. j a v a2 s. co m public void run() { v.setBackgroundColor(Color.TRANSPARENT); } }); }
From source file:org.mozilla.focus.utils.ViewUtils.java
/** * Create a snackbar with Focus branding (See #193). *//*from www . j a v a 2s. c om*/ public static void showBrandedSnackbar(View view, @StringRes int resId, int delayMillis) { final Context context = view.getContext(); final Snackbar snackbar = Snackbar.make(view, resId, Snackbar.LENGTH_LONG); final View snackbarView = snackbar.getView(); snackbarView.setBackgroundColor(ContextCompat.getColor(context, R.color.snackbarBackground)); final TextView snackbarTextView = (TextView) snackbarView .findViewById(android.support.design.R.id.snackbar_text); snackbarTextView.setTextColor(ContextCompat.getColor(context, R.color.snackbarTextColor)); snackbarTextView.setGravity(Gravity.CENTER); snackbarTextView.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); view.postDelayed(new Runnable() { @Override public void run() { snackbar.show(); } }, delayMillis); }