Example usage for android.view ViewGroup removeView

List of usage examples for android.view ViewGroup removeView

Introduction

In this page you can find the example usage for android.view ViewGroup 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:com.inno.wang.view.smartlayout.v13.ViewPagerItemAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    holder.remove(position);//from  ww w.  j  a va  2s .  c o m
    container.removeView((View) object);
}

From source file:com.socialinfotech.tabbar.smart.utils.ViewPagerItemAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    mHolder.remove(position);/*from w w  w .  j a  v  a2 s  .  com*/
    container.removeView((View) object);
}

From source file:com.aretha.slidemenu.SlideMenu.java

/**
 * Remove view child it's parent node, if the view does not have parent.
 * ignore//  w w w .  ja va2 s  .c o  m
 * 
 * @param view
 */
public static void removeViewFromParent(View view) {
    if (null == view) {
        return;
    }
    ViewGroup parent = (ViewGroup) view.getParent();
    if (null == parent) {
        return;
    }
    parent.removeView(view);
}

From source file:com.lillicoder.demo.carouselview.DemoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);

    CarouselView carousel = (CarouselView) findViewById(R.id.carousel);
    carousel.setAdapter(new CarouselView.Adapter<Pair<String, Integer>>(getCarouselItems()) {
        @Override//w w  w.  j  a va  2s. com
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public void onDestroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }

        @Override
        public Object onInstantiateItem(ViewGroup container, int position) {
            Pair<String, Integer> pair = getItem(position);

            final LayoutInflater inflater = LayoutInflater.from(container.getContext());
            TextView view = (TextView) inflater.inflate(R.layout.view_carousel_item, container, false);
            view.setBackgroundResource(pair.second);
            view.setText(pair.first);

            container.addView(view);

            return view;
        }
    });
}

From source file:net.neevek.android.lib.paginize.PagePagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    ViewWrapper viewWrapper = (ViewWrapper) object;
    container.removeView(viewWrapper.getView());
    viewWrapper.onDetach();//from   ww w .  j a  v a 2 s .co m
}

From source file:pl.acieslinski.moviefun.fragments.PortableFragment.java

private boolean switchContainer(ViewGroup container) {
    View view = getView();/*from www .  java  2 s .c  om*/
    boolean changed = false;

    if (view != null) {
        ViewGroup parent = (ViewGroup) view.getParent();

        if (parent != null) {
            parent.removeView(view);
            changed = true;
        }

        container.addView(view);
    }

    return changed;
}

From source file:com.example.ccrvlz.dcp.detail.DetailCardFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (null != rootView) {
        ViewGroup parent = (ViewGroup) rootView.getParent();
        if (null != parent) {
            parent.removeView(rootView);
        }/*  w  w  w  .  jav a  2s. c  om*/
    } else {
        rootView = inflater.inflate(R.layout.dcp_detail_card_layout, container, false);
        //////////////rootView
        WebView webView = (WebView) rootView.findViewById(R.id.web_dcp_detail_card);
        //String html = "<html><body><font>html5 test<br>html5 test<br>html5 test<br>html5 test<br></font></body></html>";
        webView.loadData(data, "text/html", "UTF-8");
    }
    return rootView;
}

From source file:dg.shenm233.mmaps.adapter.ViewPagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    BasePager pager = (BasePager) object;
    container.removeView(pager.getBindView());
    pager.onDestroy();/*from w  ww.j a  va  2  s.  co m*/
    finishUpdate(container);
}

From source file:com.robotsandpencils.walkthrough.presentation.main.paging.screens.ScreensAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    ViewGroup viewGroup = mLayouts.get(position).getView();
    ViewGroup parent = (ViewGroup) viewGroup.getParent();
    if (parent != null) {
        parent.removeView(viewGroup);
    }/*w w w .j a  va2  s . c  o  m*/
    container.addView(viewGroup);
    return viewGroup;
}

From source file:cm.aptoide.pt.adapters.ViewPagerAdapterScreenshots.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView((View) object);

}