ViewGroup removeView - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ViewGroup removeView method.

This code example shows how to use the following methods:getParent, removeView
        if (null != mEmptyView) {
            mRefreshableViewHolder.removeView(mEmptyView);
        } 
 
        if (null != newEmptyView) {
            ViewParent newEmptyViewParent = newEmptyView.getParent();
            if (null != newEmptyViewParent
                    && newEmptyViewParent instanceof ViewGroup) {
                ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
            } 
 
            this.mRefreshableViewHolder.addView(newEmptyView,
                    ViewGroup.LayoutParams.FILL_PARENT,
                    ViewGroup.LayoutParams.FILL_PARENT);
        } 
 
        if (mRefreshableView instanceof EmptyViewMethodAccessor) { 
            ((EmptyViewMethodAccessor) mRefreshableView) 
                    .setEmptyViewInternal(newEmptyView);
        } else { 

8
CodeRank
This code example shows how to use the following methods:getParent, removeView
        if (null != mEmptyView) {
            mRefreshableViewHolder.removeView(mEmptyView);
        } 
 
        if (null != newEmptyView) {
            ViewParent newEmptyViewParent = newEmptyView.getParent();
            if (null != newEmptyViewParent
                    && newEmptyViewParent instanceof ViewGroup) {
                ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
            } 
 
            this.mRefreshableViewHolder.addView(newEmptyView,
                    ViewGroup.LayoutParams.FILL_PARENT,
                    ViewGroup.LayoutParams.FILL_PARENT);
        } 
 
        if (mRefreshableView instanceof EmptyViewMethodAccessor) { 
            ((EmptyViewMethodAccessor) mRefreshableView) 
                    .setEmptyViewInternal(newEmptyView);
        } else { 

8
CodeRank
This code example shows how to use the following methods:setVisibility, removeView
			return; 
		} 
 
		// Hide the custom view and remove it from its container. 
		mCustomView.setVisibility(View.GONE);
		mCustomViewContainer.removeView(mCustomView);
		mCustomView = null;
		mCustomViewContainer.setVisibility(View.GONE);
		mCustomViewCallback.onCustomViewHidden();
 
		tiWebView.getWebView().setVisibility(View.VISIBLE);
	} 
 
	public boolean interceptOnBackPressed() 
	{ 
		if (mCustomView != null) {
			onHideCustomView(); 
			if (Log.isDebugModeEnabled()) { 
				Log.d(TAG, "WebView intercepts the OnBackPressed event to close the full-screen video.");
			} 
8
CodeRank
This code example shows how to use the following methods:getParent, removeView
 
    private static void removeFromParent(View view) {
        if (view == null) {
            return; 
        } 
        ViewParent parent = view.getParent();
        if (parent != null) {
            ((ViewGroup) parent).removeView(view);
        } 
    } 
 
    public CharSequence getTitle() {
        return mTitle.getText();
    } 
 
    public void setSubtitle(CharSequence text) {
        mSubtitle.setText(text);
        mSubtitle.setVisibility(TextUtils.isEmpty(text) ? GONE : VISIBLE);
    } 
 
7
CodeRank
This code example shows how to use the following methods:removeView
     * @param childIndex Index within the parent to insert at 
     */ 
    protected void addItemView(View itemView, int childIndex) {
        final ViewGroup currentParent = (ViewGroup) itemView.getParent();
        if (currentParent != null) {
            currentParent.removeView(itemView);
        } 
        ((ViewGroup) mMenuView).addView(itemView, childIndex);
    } 
 
    /** 
     * Filter the child view at index and remove it if appropriate. 
     * @param parent Parent to filter from 
     * @param childIndex Index to filter 
     * @return true if the child view at index was removed 
     */ 
    protected boolean filterLeftoverView(ViewGroup parent, int childIndex) {
        parent.removeViewAt(childIndex);
        return true; 
    } 
7
CodeRank
This code example shows how to use the following methods:getParent, removeView
 
    private static void removeFromParent(View view) {
        if (view == null) {
            return; 
        } 
        ViewParent parent = view.getParent();
        if (parent != null) {
            ((ViewGroup) parent).removeView(view);
        } 
    } 
 
    public CharSequence getTitle() {
        return mTitle.getText();
    } 
 
    public void setSubtitle(CharSequence text) {
        mSubtitle.setText(text);
        mSubtitle.setVisibility(TextUtils.isEmpty(text) ? GONE : VISIBLE);
    } 
 
7
CodeRank
This code example shows how to use the following methods:addView, getChildAt, removeView
This code example shows how to use the following methods:removeView
		return spinner.getSelectedItem().toString() + selectionExtra;
	} 
	 
	private void remove() { 
		if(parentView != null)
			parentView.removeView(this);
		if(tagsFragment != null)
			tagsFragment.tagEntries.remove(this);
	} 
	 
	private View.OnClickListener removeListener = new View.OnClickListener() {
		public void onClick(View v) { 
			remove(); 
		} 
	}; 
} 
6
CodeRank
This code example shows how to use the following methods:invalidate, addView, indexOfChild, removeView
			 
		} else { 
			 
			// TODO verify that parent is indeed a ViewGroup 
			ViewGroup group = (ViewGroup) parent; 
			int index = group.indexOfChild(target);
			 
			group.removeView(target);
			group.addView(container, index, lp);
			 
			container.addView(target);
	 
			this.setVisibility(View.GONE);
			container.addView(this);
			 
			group.invalidate();
			 
		} 
		 
	} 
	 
8
CodeRank
This code example shows how to use the following methods:inflate, addView, removeView
    public void takeInputQueue(InputQueue.Callback callback) {
    } 
 
    @Override 
    public void setContentView(int layoutResID) {
        setContentView(getLayoutInflater().inflate(layoutResID, getDecorView()));
    } 
 
    @Override  
    public void setContentView(View view) {
        ViewGroup decorView = getDecorView();
        if (contentView != null) {
            shadowOf(contentView).callOnDetachedFromWindow();
            decorView.removeView(contentView);
 
        } 
        contentView = view;
 
        if (contentView != null) {
            if (contentView.getParent() != decorView && contentView != decorView) {

8
CodeRank

Related ViewGroup removeView Questions & Answers:

Other ViewGroup removeView Examples

65:	        View view = (View) event.getLocalState();
66:	        ViewGroup owner = (ViewGroup) view.getParent();
67:	        owner.removeView(view);
68:	        LinearLayout container = (LinearLayout) v;
69:	        container.addView(view);

Read More

removeView Method Overview
Note: do not invoke this method from draw(android.graphics.Canvas), onDraw(android.graphics.Canvas), dispatchDraw(android.graphics.Canvas) or any related method.
See Code Examples for other Android ViewGroup Methods: