Android的空线性布局内容 [英] Android empty Linear layout contents
本文介绍了Android的空线性布局内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个线性布局内的文字。现在我想删除在java中这个文本视图。该文本视图是动态生成的。我有线性布局的ID。如何清空这个线性布局中的全部内容?
< LinearLayout中的android:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT机器人:方向=垂直机器人:ID =@ + ID /身份识别码>
< TextView的... />
< TextView的... />
< TextView的... />
< / LinearLayout中>
解决方案
您可以使用此:
的LinearLayout LL =(的LinearLayout)findViewById(R.id.myid);
ll.removeAllViews();
i have a Text view inside an linear layout. now i want to delete this text view in java. this text view is generated dynamically. I have linear layout's id. how to empty all contents inside this linear layout?
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/myid">
<TextView .../>
<TextView .../>
<TextView .../>
</LinearLayout>
解决方案
You can use this:
LinearLayout ll = (LinearLayout) findViewById(R.id.myid);
ll.removeAllViews();
这篇关于Android的空线性布局内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文