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.
在我的应用程序中,我允许用户创建新选项卡。该选项卡创建良好,但我不知道如何将已创建的布局添加到该新选项卡。
我已经尝试过setContent(R.layout.layout_browse),但这会导致强制关闭,向工厂添加视图并返回它也是如此。
setContent(R.layout.layout_browse)
那么,我该怎么做呢?
使用LayoutInflater
View view = LayoutInflater.from(getBaseContext()).inflate(R.layout.yourxmllayout, null); parent.addView(view );