List of usage examples for android.view ViewGroup setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:Main.java
public static void applyDialogStyle(ViewGroup viewGroup) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { return;// www .j a v a2s . c o m } viewGroup.setBackgroundColor(Color.BLACK); // Theme.AppCompat.Light makes all text and background black final int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { View childView = viewGroup.getChildAt(i); if (childView instanceof ListView) { childView.setBackgroundColor(Color.LTGRAY); } else if (childView instanceof ViewGroup) { applyDialogStyle((ViewGroup) childView); } else if (childView instanceof TextView) { ((TextView) childView).setTextColor(Color.WHITE); } } }
From source file:Main.java
public static void setColorForSwipeBack(Activity activity, int color, int statusBarAlpha) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { ViewGroup contentView = ((ViewGroup) activity.findViewById(android.R.id.content)); contentView.setPadding(0, getStatusBarHeight(activity), 0, 0); contentView.setBackgroundColor(calculateStatusColor(color, statusBarAlpha)); setTransparentForWindow(activity); }/*www.jav a 2 s .c o m*/ }
From source file:jahirfiquitiva.iconshowcase.utilities.Utils.java
public static void showSimpleSnackbar(Context context, View location, String text) { final int snackbarLight = ContextCompat.getColor(context, R.color.snackbar_light); final int snackbarDark = ContextCompat.getColor(context, R.color.snackbar_dark); Snackbar shortSnackbar = Snackbar.make(location, text, Snackbar.LENGTH_SHORT); ViewGroup shortGroup = (ViewGroup) shortSnackbar.getView(); shortGroup.setBackgroundColor(ThemeUtils.darkTheme ? snackbarDark : snackbarLight); shortSnackbar.show();/*from w w w. j a v a2 s . c o m*/ }
From source file:com.gosuncn.core.util.view.StatusBarUtils.java
/** * ???//from w w w .jav a 2 s . c o m * * @param activity ?activity * @param color ?? * @param statusBarAlpha ??? */ public static void setColorForSwipeBack(Activity activity, int color, int statusBarAlpha) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { ViewGroup contentView = ((ViewGroup) activity.findViewById(android.R.id.content)); contentView.setPadding(0, getStatusBarHeight(activity), 0, 0); contentView.setBackgroundColor(calculateStatusColor(color, statusBarAlpha)); setTransparentForWindow(activity); } }
From source file:io.digibyte.tools.animation.BRAnimator.java
public static void animateBackgroundDim(final ViewGroup backgroundLayout, boolean reverse) { int transColor = reverse ? R.color.black_trans : android.R.color.transparent; int blackTransColor = reverse ? android.R.color.transparent : R.color.black_trans; ValueAnimator anim = new ValueAnimator(); anim.setIntValues(transColor, blackTransColor); anim.setEvaluator(new ArgbEvaluator()); anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override// ww w . jav a 2 s . c o m public void onAnimationUpdate(ValueAnimator valueAnimator) { backgroundLayout.setBackgroundColor((Integer) valueAnimator.getAnimatedValue()); } }); anim.setDuration(SLIDE_ANIMATION_DURATION); anim.start(); }
From source file:it.crs4.most.ehrlib.ArchetypeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.formContainer = this.wp.buildFormView(0); ViewGroup rootView = formContainer.getLayout(); rootView.setBackgroundColor(Color.BLACK); return rootView; }
From source file:com.liuguangqiang.support.utils.SnackbarHelper.java
private Snackbar build(View view, @NonNull String msg) { Snackbar snackbar = Snackbar.make(view, msg, Snackbar.LENGTH_SHORT); if (bgColor != 0) { ViewGroup group = (ViewGroup) snackbar.getView(); group.setBackgroundColor(ContextCompat.getColor(view.getContext(), bgColor)); }/*from ww w . j a v a 2s.c o m*/ return snackbar; }
From source file:com.liferay.mobile.screens.testapp.ThemeActivity.java
private void showSnackbarWithColor(String message, int color) { Snackbar snackbar = Snackbar.make(content, message, Snackbar.LENGTH_SHORT); ViewGroup group = (ViewGroup) snackbar.getView(); group.setBackgroundColor(color); snackbar.show();//from w w w.j a v a 2 s. c o m }
From source file:tripin.com.tripin_shipper.fragment.AddressSwapDropFragment.java
@Nullable @Override/*w w w.j av a 2 s . c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { container.setBackgroundColor(Color.WHITE); return new RecyclerView(container.getContext()); }
From source file:tripin.com.tripin_shipper.fragment.AddressSwapPickUpFragment.java
@Nullable @Override/* w w w . j a v a 2 s . c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { container.setBackgroundColor(Color.WHITE); return new RecyclerView(container.getContext()); }