由网友(初吻给了烟、)分享简介:我的工作一TabHost每个片段内的WebView。我做的是:I am working on a TabHost with a WebView inside of each Fragment.What I do is:for(int i = 0; i < numberOfTabs; i++){mTabManage...
我的工作一TabHost每个片段内的WebView。我做的是:
I am working on a TabHost with a WebView inside of each Fragment. What I do is:
for(int i = 0; i < numberOfTabs; i++){
mTabManager.addTab(mTabHost.newTabSpec(tabNames[i]).setIndicator(tabNames[i]),
Web.class, null);
}
我怎样才能将参数传递给每一个片段。在这种情况下,我想一个URL传递给TabHost内的每个片段。
How can I pass parameters to each Fragment. In this case I want to pass an URL to each Fragment inside the TabHost.
Thx提前。
推荐答案
最后我得到的解决方案。您可以通过在addTab最后一个参数使用捆绑,你有空的参数。
Finally I get the solution. You can pass parameters using a Bundle in the last parameter of "addTab" where you have "null".
for(int i = 0; i < numberOfTabs; i++){
Bundle b = new Bundle();
b.put...
mTabManager.addTab(mTabHost.newTabSpec(tabNames[i]).setIndicator(tabNames[i]),
Web.class, b);
}
然后在片段你可以得到getArguments捆()。
And then in the Fragment you can get the Bundle with getArguments().
我希望这将是有用的人,将来
I hope it will be useful for someone in the future
相关推荐
最新文章