为什么看不见的LinearLayout占用空间? [英] Why does a LinearLayout which is invisible take up space?
本文介绍了为什么看不见的LinearLayout占用空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下LinearLayout ...
I've got the following LinearLayout...
<LinearLayout android:id="@+id/linearLayout3" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/S"></TextView>
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/b"></TextView>
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/Ar"></TextView>
</LinearLayout>
我已将visible设置为invisible,但是LinearLayout仍然占用空间,导致布局中其他两个linearlayout之间出现填充,为什么?如何使其不占用空间?
I've set the visibly to invisible but the LinearLayout still takes up space causing padding between two other linearlayouts in the layout, why? How do I make it take up no space?
推荐答案
因为如果您希望视图不占用空间,则必须将可见性设置为gone
.
Because you have to set the visibility to gone
if you want that the view takes no space.
这篇关于为什么看不见的LinearLayout占用空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文