开发者

Make part of layout invisible and the other part visible

I would like to make a LinearLayout that was created from xml invisi开发者_开发知识库ble, and another LinearLayout visible to replace it. The replacement layout starts out as invisible. When I make the originally visible layout invisible, it still leaves space for it on the screen. How can I refresh the screen so that space is gone?


Perhaps you are mixing up View.INVISIBLE with View.GONE:

int GONE This view is invisible, and it doesn't take any space for layout purposes.

int INVISIBLE This view is invisible, but it still takes up space for layout purposes.


I have done this before and its actually very simple. Make 2 different layout xml files, one for each layout you want to show. When you want to switch from one to the other, all you have to do is call setContentView(R.layout.some_layout) and you're done!

pretty easy eh?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜