<FrameLayout>

<RelativeLayout> </RelativeLayout>

<RelativeLayout> </RelativeLayout>

</FrameLayout>


구성은 위와 같이 되어있습니다.


1 위에 2 가 겹쳐져 있습니다.


i)

framelayout.setOnTouchListener()

이벤트 등록을 한후

ACTION_MOVE 일때. 2를 움직인 x좌표만큼 옮기고 싶습니다.


ii)

ACTION_UP일때 2는 완전히 보이지 않아야 합니다.

2가 보이지 않고 1만 보이는 상태에서 ACTION_DOWN 후 ACTION_UP했을때 2가 다시 보여야 합니다.



제가 oncreate에서 

FrameLayout frm = (FrameLayout) findviewbyid(R.id.frm);

RelativeLayout lay2 = (RelativeLayout) findviewbyid(R.id.lay2);


frm.removeView(lay2);


하고

ACTION_UP했을때 

frm.addView(lay2);

했는데 lay2가 null 이되어 뻑나더군요..

removeView(lay2)를 하면서 lay2가 날라가 버리는거 같습니다.



해결법을 찾고 싶습니다.