我正在使用ActionBarTabs在活动中实现3个标签。选项卡在操作栏下方以纵向模式正确显示当我切换到横向模式时,选项卡与操作栏位于同一行。如何强制标签在横向模式下单独显示(在操作栏下方)?
我的代码是
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tabhost_act);
/* Action Bar Color change on create*/
ActionBar actionBar = getActionBar();
ActionBarColor.setBackgroundColor(actionBar);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setTitle(Html.fromHtml("<font color=\"white\" face=\"verdana,arial\">" + getString(R.string.air) + "</font>"));
// Session Manager
session = new SessionManager(getApplicationContext());
/* To Get Unique Device id */
TelephonyManager TelephonyMgr = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
szImeiId = TelephonyMgr.getDeviceId(); // Requires READ_PHONE_STATE.
// get User Details from Session
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap = session.getUserDetails();
usrNm = hashMap.get(SessionManager.KEY_USRNM);
vp = (ViewPager) findViewById(R.id.pager);
vp.setAdapter(new MyPageAdapter(getSupportFragmentManager()));
ab = getActionBar();
ActionBar.Tab tab1 = ab.newTab();
tab1.setText("INFO");
tab1.setTabListener(this);
ActionBar.Tab tab2 = ab.newTab();
tab2.setText("PORT");
tab2.setTabListener(this);
ActionBar.Tab tab3 = ab.newTab();
tab3.setText("PACKAGES");
tab3.setTabListener(this);
ab.addTab(tab1);
ab.addTab(tab2);
ab.addTab(tab3);
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);<--used bt not working
// for calling fragment instnace
adapter=new MyPageAdapter(getSupportFragmentManager());
vp.setAdapter(adapter);
}
提到同样的问题 Link
<com.eanda.frete_sales.common.utils.NonSwipeableViewPager xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
style="@style/My.TabText.Style">
</com.eanda.frete_sales.common.utils.NonSwipeableViewPager>