Example usage for android.widget GridLayout removeView

List of usage examples for android.widget GridLayout removeView

Introduction

In this page you can find the example usage for android.widget GridLayout removeView.

Prototype

@Override
public void removeView(View view) 

Source Link

Document

Note: do not invoke this method from #draw(android.graphics.Canvas) , #onDraw(android.graphics.Canvas) , #dispatchDraw(android.graphics.Canvas) or any related method.

Usage

From source file:io.palaima.debugdrawer.DebugWidgetsFrame.java

private void inflateModules(BaseDebugModule module, GridLayout gl) {
    module.setActivity(activity);/*from w w  w. j  a v  a 2  s .com*/
    View titleV = LayoutInflater.from(activity).inflate(R.layout.dd_module_title, null, false);
    ((TextView) titleV.findViewById(R.id.title_tv)).setText(module.getName());
    GridLayout.LayoutParams params = getSpanColParams(gl);
    params.setMargins(0, 20, 0, 3);
    gl.addView(titleV, params);

    DebugWidgetStore widgets = module.createWidgetStore(new DebugWidgetStore.Builder(activity));
    if (widgets == null) {
        gl.removeView(titleV);
        return;
    }

    for (DebugWidget widget : widgets.getWidgets()) {
        if (widget.title != null) {
            // add title widget
            TextView tv = new TextView(
                    new ContextThemeWrapper(activity, R.style.Widget_DebugDrawer_Base_RowTitle));
            tv.setText(widget.title);
            gl.addView(tv);

            // add summary widget
            gl.addView(widget.view);
        } else {
            gl.addView(widget.view, getSpanColParams(gl));
        }
    }
}