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.zhongsou.souyue.ui.gallery.UrlPagerAdapter.java

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

From source file:com.wstro.app.common.base.BaseFragment.java

@Override
public void onDestroyView() {
    super.onDestroyView();
    ButterKnife.unbind(this);

    if (this.rootView.getParent() != null) {
        ViewGroup parent = (ViewGroup) this.rootView.getParent();
        parent.removeView(this.rootView);
    }//from w w w.  jav  a 2  s  . com
}

From source file:com.android.fastexample.adapter.FragmentViewPagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView(fragments.get(position).getView()); // viewpagerpage
}

From source file:am.util.viewpager.adapter.ViewsPagerAdapter.java

@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    container.removeView(mListViews.get(position));
}

From source file:com.android.fastlibrary.ui.fragment.CoreFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (currentView == null) {
        currentView = setRootView(inflater, container, savedInstanceState);
        ButterKnife.inject(currentView);
        initWidget(currentView);/*from   w w w.ja v a 2  s .c o m*/
        new Thread(new Runnable() {
            @Override
            public void run() {
                initAsyncData();
            }
        }).start();
        initData();
    }
    /**
     * rootView???parentparent?parentview
     * ???rootview?parent
     */
    ViewGroup parent = (ViewGroup) currentView.getParent();
    if (parent != null) {
        parent.removeView(currentView);
    }
    return currentView;
}

From source file:com.yojiokisoft.japanesecalc.SkinPagerAdapter.java

/**
 * @see PagerAdapter#destroyItem(ViewGroup, int, Object)
 *//*from   w ww  . ja  v a  2 s .  c o  m*/
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    // ? View 
    container.removeView((View) object);
}

From source file:com.lamcreations.scaffold.common.activities.CoordinatorActivity.java

private void initFab() {
    mFloatingActionButton = (FloatingActionButton) findViewById(R.id.scaffold_floating_action_button);
    if (mFloatingActionButton != null) {
        CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) mFloatingActionButton
                .getLayoutParams();//from   w w  w . jav  a 2 s.c  om
        layoutParams.setAnchorId(getFabAnchorId());
        layoutParams.anchorGravity = getFabAnchorGravity();
        layoutParams.setBehavior(getFabBehavior());
        boolean show = setupFab();
        if (!show) {
            ViewGroup parent = (ViewGroup) mFloatingActionButton.getParent();
            parent.removeView(mFloatingActionButton);
        }
    }
}

From source file:com.camnter.easygank.core.BaseFragment.java

/**
 * @param inflater           The LayoutInflater object that can be used to inflate
 *                           any views in the fragment,
 * @param container          If non-null, this is the parent view that the fragment's
 *                           UI should be attached to.  The fragment should not add the view itself,
 *                           but this can be used to generate the LayoutParams of the view.
 * @param savedInstanceState If non-null, this fragment is being re-constructed
 *                           from a previous saved state as given here.
 * @return Return the View for the fragment's UI, or null.
 *///from   w w  w.  j a va 2  s .co m
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    if (this.self == null) {
        this.self = inflater.inflate(this.getLayoutId(), container, false);
    }
    if (this.self.getParent() != null) {
        ViewGroup parent = (ViewGroup) this.self.getParent();
        parent.removeView(this.self);
    }

    this.initViews(this.self, savedInstanceState);
    this.initData();
    this.initListeners();
    return this.self;
}

From source file:org.mariotaku.twidere.fragment.ActivityHostFragment.java

@SuppressWarnings({ "deprecation", "unchecked" })
@Override//from  w ww  .ja  v  a  2  s .c o  m
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final Intent intent = new Intent(getActivity(), getActivityClass());
    final Bundle args = getArguments();
    if (args != null) {
        intent.putExtras(args);
    }

    final Window w = getLocalActivityManager().startActivity(ACTIVITY_TAG, intent);
    mAttachedActivity = null;
    final Context context = w.getContext();
    if (context instanceof Activity) {
        try {
            mAttachedActivity = (A) context;
            if (context instanceof FragmentCallback) {
                ((FragmentCallback<A>) context).setCallbackFragment(this);
            }
        } catch (final ClassCastException e) {
            // This should't happen.
            e.printStackTrace();
        }
    }
    final View wd = w != null ? w.getDecorView() : null;

    if (wd != null) {
        final ViewParent parent = wd.getParent();
        if (parent != null) {
            final ViewGroup v = (ViewGroup) parent;
            v.removeView(wd);
        }

        wd.setVisibility(View.VISIBLE);
        wd.setFocusableInTouchMode(true);
        if (wd instanceof ViewGroup) {
            ((ViewGroup) wd).setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
        }
    }
    return wd;
}

From source file:com.vehicletracking.VehicleInfoDialog.java

@Nullable
@Override//  w ww  .j  a v a  2  s .  co m
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    if (view != null) {
        ViewGroup parent = (ViewGroup) view.getParent();
        if (parent != null)
            parent.removeView(view);
    }
    try {
        view = inflater.inflate(R.layout.dialog_vehicle_info, container, false);
    } catch (InflateException e) {
        Log.d("Error", "Inflate Exception", e);
    }
    Bundle args = getArguments();
    vehicle = (Vehicle) args.getSerializable("Vehicle");

    TextView vehicleType = (TextView) view.findViewById(R.id.vehicle_type);
    vehicleType.setText(vehicle.getDeviceType());

    TextView licensePlate = (TextView) view.findViewById(R.id.vehicle__license_plate);
    licensePlate.setText(vehicle.getLicensePlate());

    FragmentManager fm = getChildFragmentManager();
    mapFragment = (SupportMapFragment) fm.findFragmentByTag("mapFragment");
    if (mapFragment == null) {
        mapFragment = new SupportMapFragment();
        FragmentTransaction ft = fm.beginTransaction();
        ft.add(R.id.vehicle_last_seen_container, mapFragment, "mapFragment");
        ft.commit();

    }

    mapFragment.getMapAsync(this);

    return view;
}