最近做了一个android tabspec 但是当来回切换选项卡的时候会出现内容重叠!哪位大神有空的话帮忙看看! 30
2个回答
展开全部
你可以尝试每次切换有调用新的Activity。我就这么写的。没有问题。我把代码给你看看
public class TabMeActivity extends TabActivity {
private TabHost tabHost;
private TabSpec tabspec;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置窗口全屏
tabHost = getTabHost();
tabspec=tabHost.newTabSpec("tab1");
tabspec.setIndicator("应用软件",getResources().getDrawable(R.drawable.ic_launcher));
tabspec.setContent(new Intent(this, MeActivity.class));
tabHost.addTab(tabspec);
tabHost.addTab(tabHost.newTabSpec("tab2")
.setIndicator("我的常用软件")
.setContent(new Intent(this, ScreenChangeActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
tabHost.addTab(tabHost.newTabSpec("tab3")
.setIndicator("设置状态")
.setContent(new Intent(this, MePreference.class)));
tabHost.addTab(tabHost.newTabSpec("tab4")
.setIndicator("我的语音工具")
.setContent(new Intent(this, speechActivity.class)));
tabHost.addTab(tabHost.newTabSpec("tab5")
.setIndicator("我的工具")
.setContent(new Intent(this,toolActivity.class)));
}
}
我这样用从来没出现过重叠问题
public class TabMeActivity extends TabActivity {
private TabHost tabHost;
private TabSpec tabspec;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置窗口全屏
tabHost = getTabHost();
tabspec=tabHost.newTabSpec("tab1");
tabspec.setIndicator("应用软件",getResources().getDrawable(R.drawable.ic_launcher));
tabspec.setContent(new Intent(this, MeActivity.class));
tabHost.addTab(tabspec);
tabHost.addTab(tabHost.newTabSpec("tab2")
.setIndicator("我的常用软件")
.setContent(new Intent(this, ScreenChangeActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
tabHost.addTab(tabHost.newTabSpec("tab3")
.setIndicator("设置状态")
.setContent(new Intent(this, MePreference.class)));
tabHost.addTab(tabHost.newTabSpec("tab4")
.setIndicator("我的语音工具")
.setContent(new Intent(this, speechActivity.class)));
tabHost.addTab(tabHost.newTabSpec("tab5")
.setIndicator("我的工具")
.setContent(new Intent(this,toolActivity.class)));
}
}
我这样用从来没出现过重叠问题
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询