Example usage for android.widget FrameLayout setDrawingCacheBackgroundColor

List of usage examples for android.widget FrameLayout setDrawingCacheBackgroundColor

Introduction

In this page you can find the example usage for android.widget FrameLayout setDrawingCacheBackgroundColor.

Prototype

@Deprecated
public void setDrawingCacheBackgroundColor(@ColorInt int color) 

Source Link

Document

Setting a solid background color for the drawing cache's bitmaps will improve performance and memory usage.

Usage

From source file:com.nadmm.airports.ActivityBase.java

public View createContentView(View view) {
    FrameLayout root = new FrameLayout(this);
    int white = ContextCompat.getColor(this, android.R.color.white);
    root.setBackgroundColor(white);//from  w ww  .  j ava  2s  . c om
    root.setDrawingCacheBackgroundColor(white);
    root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    LinearLayout pframe = new LinearLayout(this);
    pframe.setId(R.id.INTERNAL_PROGRESS_CONTAINER_ID);
    pframe.setGravity(Gravity.CENTER);

    ProgressBar progress = new ProgressBar(this, null, android.R.attr.progressBarStyleLarge);
    pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    FrameLayout lframe = new FrameLayout(this);
    lframe.setId(R.id.INTERNAL_FRAGMENT_CONTAINER_ID);
    lframe.setVisibility(View.GONE);

    lframe.addView(view, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    return root;
}