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.
可以在运行时在我的活动中设置另一个布局吗?
怎么可能?
只做 setContextView(new layout ) 它会在执行中出错
问候
我建议您过渡到新的Activity而不是setContentView()再次调用。
Activity
setContentView()
如果您想再次调用setContentView(),则必须再次重新初始化Views布局中的所有内容,findViewById()并确保不使用或泄漏旧引用。
Views
findViewById()