remove Parent View - Android User Interface

Android examples for User Interface:View Parent

Description

remove Parent View

Demo Code


//package com.java2s;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;

public class Main {
    public static void removeParent(View v) {
        ViewParent parent = v.getParent();
        if (parent instanceof ViewGroup) {
            ViewGroup group = (ViewGroup) parent;
            group.removeView(v);// w  w w .j  a  va  2  s.co m
        }
    }
}

Related Tutorials