Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我将 Screen 元素设置为在“LinearLayout”中不可见,那么无论如何我都会有一个间隙而不是它。如何使间隙与元素一起消失?
谢谢
当您将视图设置为不可见时,您View仍然会在那里消失,但在您使用消失时会占用它的空间,这将删除您的视图
View
这将解决您的问题
view.setVisibility(View.GONE);
您是否尝试将“可见”属性设置为“消失”?
使用view.setVisibility(View.GONE)