我在我的应用程序中使用TabHost和我想开一个网页,当我点击的项目从一个选项卡的列表到另一个选项卡。
I am using TabHost in my application and I want to open a webPage when I click on the Item from the List of one Tab into the another Tab.
我指的是列表是一个标签,当我点击一个项目从名单中,我想在另一个选项卡中打开网页。
I mean the list is in one Tab and when I click on an item from the list, I want to open the WebPage in to another Tab.
我可以母鹿呢?如果是比请告诉我怎么样?
Can I doe this? If yes than please tell me how?
谢谢, 大卫
在假设你有你的标签设置是这样的:
In the assumption that you've got your tabs setup like this :
LocalActivityManager localActivityManager = new LocalActivityManager(this, false);
tabHost.setup(localActivityManager);
TabSpec spec = tabHost.newTabSpec("tab1").setIndicator("My List").setContent(R.id.layout_tab1);
tabHost.addTab(spec);
spec = tabHost.newTabSpec("tab2").setIndicator("My Browser").setContent(R.id.layout_tab2);
tabHost.addTab(spec);
在你的动作(一个按钮单击下面的代码片段),只需将当前选项卡上的tabhost。
In your action (a button click in the snippet below), just set the current tab on your tabhost.
btnSearch.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
tabHost.setCurrentTab(1);
}
});
下一篇:活动未找到厚望厚望、未找到