开发者

Changing the content view dynamically

开发者 https://www.devze.com 2023-02-14 20:52 出处:网络
I am new to android and am trying to figure out how to change the co开发者_StackOverflow社区ntentView at will.

I am new to android and am trying to figure out how to change the co开发者_StackOverflow社区ntentView at will.

Right now, I have a TableLayout in the content view and it was set using the setContentView(TableLayout) method.

However, if I wanted to change this contentview within the same activity, how would I invoke this? Would I simply invoke the same method like: setContentView(TableLayout2) or would I need to clear the screen first?

What is the procedure for staying within the same activity and changing the content on the screen?

Thanks!


This answer might help.

No, you can't call it multiple times easily. You either need to entirely remove all views and then inflate the new layout, or use a ViewFlipper (or FrameLayout) to switch between different views.

0

精彩评论

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