通过点击事件,把被叠住的View顶部(类似z-index)

一、布局文件相关定义




    
	    
	    
    
    
	    
	    
    

二、相关java代码(仅事件方法)

public void iv1click(View view)
{
	ViewGroup vg = (ViewGroup)view.getParent();
	int index = vg.indexOfChild(view);
	vg.bringChildToFront(vg.getChildAt(index));
	vg.invalidate();
}
public void iv2click(View view)
{
	ViewGroup vg = (ViewGroup)view.getParent();
	int index = vg.indexOfChild(view);
	vg.bringChildToFront(vg.getChildAt(index));
	vg.invalidate();
}
public void iv3click(View view)
{
	ViewGroup vg = (ViewGroup)view.getParent();
	int index = vg.indexOfChild(view);
	vg.bringChildToFront(vg.getChildAt(index));
	vg.invalidate();
}
public void iv4click(View view)
{
	ViewGroup vg = (ViewGroup)view.getParent();
	int index = vg.indexOfChild(view);
	vg.bringChildToFront(vg.getChildAt(index));
	vg.invalidate();
}


你可能感兴趣的:(android)