Example usage for android.view ViewGroup setBackgroundColor

List of usage examples for android.view ViewGroup setBackgroundColor

Introduction

In this page you can find the example usage for android.view ViewGroup setBackgroundColor.

Prototype

@RemotableViewMethod
public void setBackgroundColor(@ColorInt int color) 

Source Link

Document

Sets the background color for this view.

Usage

From source file:cn.zhangls.android.weibo.common.SwipeActivity.java

/**
 * ?/*from  w w  w .  ja v  a2 s.  c  o  m*/
 */
private void initSwipeBackFinish() {
    SlidingPaneLayout slidingPaneLayout = new SlidingPaneLayout(this);
    //???mOverhangSize0mOverhangSize?????
    //32dp?0
    try {
        //
        Field f_overHang = SlidingPaneLayout.class.getDeclaredField("mOverhangSize");
        f_overHang.setAccessible(true);
        f_overHang.set(slidingPaneLayout, 0);
    } catch (Exception e) {
        e.printStackTrace();
    }
    slidingPaneLayout.setPanelSlideListener(this);
    slidingPaneLayout.setSliderFadeColor(getResources().getColor(android.R.color.transparent));

    View leftView = new View(this);
    leftView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    slidingPaneLayout.addView(leftView, 0);

    ViewGroup decor = (ViewGroup) getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
    decorChild.setBackgroundColor(getResources().getColor(android.R.color.white));
    decor.removeView(decorChild);
    decor.addView(slidingPaneLayout);
    slidingPaneLayout.addView(decorChild, 1);
}

From source file:com.example.administrator.animex.ScreenSlidePageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    int color = Color.parseColor(mColorArray[mPageNumber]);
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false);

    rootView.setBackgroundColor(color);
    // Set the title view to show the page number.
    ((TextView) rootView.findViewById(R.id.text1)).setText("" + mPageNumber);

    return rootView;
}

From source file:eu.liveGov.libraries.livegovtoolkit.activities_fragments.ListaFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    container.setBackgroundColor(Color.WHITE);
    return super.onCreateView(inflater, container, savedInstanceState);
}

From source file:jahirfiquitiva.iconshowcase.tasks.CopyFilesToStorage.java

@Override
protected void onPostExecute(Boolean worked) {
    dialog.dismiss();//from  w w  w .j ava  2 s.c  o  m
    if (layout != null) {
        Snackbar longSnackbar = Snackbar.make(layout, context.get().getString(R.string.assets_installed),
                Snackbar.LENGTH_SHORT);
        final int snackbarLight = ContextCompat.getColor(context.get(), R.color.snackbar_light);
        final int snackbarDark = ContextCompat.getColor(context.get(), R.color.snackbar_dark);
        ViewGroup snackbarView = (ViewGroup) longSnackbar.getView();
        snackbarView.setBackgroundColor(ThemeUtils.darkTheme ? snackbarDark : snackbarLight);
        longSnackbar.show();
    }
}

From source file:jahirfiquitiva.iconshowcase.tasks.WallpaperToCrop.java

@Override
protected void onPostExecute(Boolean worked) {
    if (!wasCancelled) {
        if (toHide1 != null && toHide2 != null) {
            toHide1.setVisibility(View.GONE);
            toHide2.setVisibility(View.GONE);
        }/*  ww  w.  j av a2  s  .com*/
        if (worked) {
            dialog.dismiss();
            Intent setWall = new Intent(Intent.ACTION_ATTACH_DATA);
            setWall.setDataAndType(wallUri, "image/*");
            setWall.putExtra("png", "image/*");
            wrActivity.get().startActivityForResult(
                    Intent.createChooser(setWall, context.getResources().getString(R.string.set_as)), 1);
        } else {
            dialog.dismiss();
            Snackbar snackbar = Snackbar.make(layout, context.getResources().getString(R.string.error),
                    Snackbar.LENGTH_SHORT);
            final int snackbarLight = ContextCompat.getColor(context, R.color.snackbar_light);
            final int snackbarDark = ContextCompat.getColor(context, R.color.snackbar_dark);
            ViewGroup snackbarView = (ViewGroup) snackbar.getView();
            snackbarView.setBackgroundColor(ThemeUtils.darkTheme ? snackbarDark : snackbarLight);
            snackbar.show();
            snackbar.setCallback(new Snackbar.Callback() {
                @Override
                public void onDismissed(Snackbar snackbar, int event) {
                    super.onDismissed(snackbar, event);
                    if (toHide1 != null && toHide2 != null) {
                        toHide1.setVisibility(View.VISIBLE);
                        toHide2.setVisibility(View.VISIBLE);
                    }
                }
            });
        }
    }
}

From source file:net.abcdroid.devfest12.ui.ExploreFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_list_with_empty_container, container,
            false);//from ww  w.  j av a  2s.c  o m
    root.setBackgroundColor(Color.WHITE);
    return root;
}

From source file:jahirfiquitiva.iconshowcase.tasks.ApplyWallpaper.java

@Override
protected void onPostExecute(Boolean worked) {
    if (!wasCancelled) {
        if (worked) {
            dialog.dismiss();/*from www. j  a va 2  s.c  o m*/
            if (!isPicker) {

                if (toHide1 != null && toHide2 != null) {
                    toHide1.setVisibility(View.GONE);
                    toHide2.setVisibility(View.GONE);
                } else {
                    ShowcaseActivity.setupToolbarHeader(activity, ShowcaseActivity.toolbarHeader);
                    ColorExtractor.setupToolbarIconsAndTextsColors(activity, ShowcaseActivity.appbar,
                            ShowcaseActivity.toolbar, ShowcaseActivity.toolbarHeaderImage);
                }

                Snackbar longSnackbar = Snackbar.make(layout, activity.getString(R.string.set_as_wall_done),
                        Snackbar.LENGTH_LONG);
                final int snackbarLight = ContextCompat.getColor(activity, R.color.snackbar_light);
                final int snackbarDark = ContextCompat.getColor(activity, R.color.snackbar_dark);
                ViewGroup snackbarView = (ViewGroup) longSnackbar.getView();
                snackbarView.setBackgroundColor(ThemeUtils.darkTheme ? snackbarDark : snackbarLight);
                longSnackbar.show();
                longSnackbar.setCallback(new Snackbar.Callback() {
                    @Override
                    public void onDismissed(Snackbar snackbar, int event) {
                        super.onDismissed(snackbar, event);
                        if (toHide1 != null && toHide2 != null) {
                            toHide1.setVisibility(View.VISIBLE);
                            toHide2.setVisibility(View.VISIBLE);
                        }
                    }
                });
            }
        } else {
            showRetrySnackbar();
        }
        if (isPicker) {
            activity.finish();
        }
    }
}

From source file:jahirfiquitiva.iconshowcase.activities.MuzeiSettings.java

private void showSnackBarAndFinish(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_LONG);
    ViewGroup shortGroup = (ViewGroup) shortSnackbar.getView();
    shortGroup.setBackgroundColor(ThemeUtils.darkTheme ? snackbarDark : snackbarLight);
    shortSnackbar.setCallback(new Snackbar.Callback() {
        @Override/*from www  .j a va 2  s  .c o  m*/
        public void onDismissed(Snackbar snackbar, int event) {
            super.onDismissed(snackbar, event);
            finish();
        }
    });
    shortSnackbar.show();
}

From source file:edu.vuum.mocca.ui.tags.CreateTagsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.tags_creation_fragment, container, false);
    container.setBackgroundColor(Color.GRAY);
    return view;//from  w  ww.  j  ava  2 s.  co  m
}

From source file:edu.vuum.mocca.ui.tags.TagsViewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.tags_view_fragment, container, false);
    container.setBackgroundColor(Color.GRAY);
    return view;//from   ww  w .j a  v a  2s . com
}