当我从它们开始活动时,我的 ActionBar 选项卡正在消失。我可以正常看到活动,但选项卡没有出现。
我的 SherlockFragmentActivity 是 -
public class FragmentDemoActivity extends SherlockFragmentActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar bar = getSupportActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
ActionBar.Tab tab1 = bar.newTab();
ActionBar.Tab tab2 = bar.newTab();
tab1.setText("Fragment A");
tab2.setText("Fragment B");
tab1.setTabListener(new MyTabListener());
tab2.setTabListener(new MyTabListener());
bar.addTab(tab1);
bar.addTab(tab2);
}
private class MyTabListener implements ActionBar.TabListener
{
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
if(tab.getPosition()==0)
{
CalendarViewActivity frag = new CalendarViewActivity();
startActivity(new Intent(getApplicationContext(),CalendarViewActivity.class));
//ft.replace(android.R.id.content, frag);
}
else
{
TestActivity frag = new TestActivity();
//ft.replace(android.R.id.content, frag);
}
}
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
}
}
虽然我的 Acitivity 是一个普通的 Android Activity -
public class CalendarViewActivity extends Activity
请提供任何帮助。
而我的