2012-03-08 3 views
43

선형 레이아웃 안에 텍스트보기가 있습니다. 지금 내가 자바 에서이 텍스트보기를 삭제하려면. 이 텍스트보기는 동적으로 생성됩니다. 선형 레이아웃의 ID가 있습니다. 이 선형 레이아웃 내부의 모든 내용을 비우는 방법?Android 빈 선형 레이아웃 내용

<LinearLayout android:layout_width="match_parent" 
     android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/myid"> 

<TextView .../> 

<TextView .../> 

<TextView .../> 
</LinearLayout> 

답변

116

이를 사용할 수 있습니다

LinearLayout ll = (LinearLayout) findViewById(R.id.myid); 
ll.removeAllViews(); 
+1

1 예, 당신이 옳다. – Luksprog

관련 문제