如何在标签点击或选择上打开webView 在标签 i == 3 上单击事件或选择事件。我想打开网页视图而不打开标签我该怎么做。 这是我的代码,选项卡上有4个选项卡 i == 3 点击事件我直接想要WebView而不打开标签。
for (int i=0; i<tabs.length; i++){
if(i==0)
{
LayoutInflater layoutInflater=getLayoutInflater();
View view=layoutInflater.inflate(R.layout.tab_details, null);
actionBar.addTab(actionBar.newTab()
//.setCustomView(view)
.setCustomView(R.layout.tab_details)
.setTabListener(this));
}
else if(i==1){
LayoutInflater layoutInflater=getLayoutInflater();
View view=layoutInflater.inflate(R.layout.tab_contact, null);
actionBar.addTab(actionBar.newTab()
//.setCustomView(view)
.setCustomView(R.layout.tab_contact)
.setTabListener(this));
}
else if(i==2){
LayoutInflater layoutInflater=getLayoutInflater();
View view=layoutInflater.inflate(R.layout.tab_map, null);
actionBar.addTab(actionBar.newTab()
//.setCustomView(view)
.setCustomView(R.layout.tab_map)
.setTabListener(this));
}
else if(i==3){
//here I want directly open WebView without opening tab
}
else
{
actionBar.addTab(actionBar.newTab()
.setText(tabs[i])
.setIcon(MainActivity.this.getResources()
.getDrawable(ticons[i]))
.setTabListener(this));
}
}
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
actionBar.setSelectedNavigationItem(position);
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int arg0) {
}
});
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}
我希望我让所有人都明白我的意思