Example usage for android.view SurfaceView setBackgroundColor

List of usage examples for android.view SurfaceView setBackgroundColor

Introduction

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

Prototype

@RemotableViewMethod
public void setBackgroundColor(@ColorInt int color) 

Source Link

Document

Sets the background color for this view.

Usage

From source file:org.blanco.lacuenta.misc.EmptyFragment.java

@Override
public View getView() {
    SurfaceView v = new SurfaceView(getActivity());
    v.setBackgroundColor(Color.BLUE);
    return v;// ww  w . j a v a 2  s  . c o  m
}

From source file:ti.map.TiUIMapView.java

/**
 * Traverses through the view hierarchy to locate the SurfaceView and set
 * the background to transparent.//from   w w  w  .  j a  va 2s. c o  m
 *
 * @param v
 *            the root view
 */
private void setBackgroundTransparent(View v) {
    if (v instanceof SurfaceView) {
        SurfaceView sv = (SurfaceView) v;
        sv.setBackgroundColor(Color.TRANSPARENT);
    }

    if (v instanceof ViewGroup) {
        ViewGroup viewGroup = (ViewGroup) v;
        for (int i = 0; i < viewGroup.getChildCount(); i++) {
            setBackgroundTransparent(viewGroup.getChildAt(i));
        }
    }
}