Android actionBar标签在横向视图中没有';不占全幅
我只想在我的动作栏中显示标签,所以我通过编程隐藏标题和主页图标Android actionBar标签在横向视图中没有';不占全幅,android,tabs,android-actionbar,landscape,Android,Tabs,Android Actionbar,Landscape,我只想在我的动作栏中显示标签,所以我通过编程隐藏标题和主页图标 viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setDisplaySho
viewPager = (ViewPager) findViewById(R.id.pager);
actionBar = getActionBar();
mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mAdapter);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
在纵向模式下,一切正常。选项卡占据整个宽度空间
但是如果我切换到横向模式,标签大约占据40%的宽度
我想在横向模式下展开选项卡,就像在纵向模式下一样。我尝试了很多方法,但没有找到任何解决办法。有可能或者只有一种方法是使用TabHost
编辑:我的寻呼机布局:
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
能否在XML文件中显示与寻呼机相关的部分?这里有一些建议,你可以应用于他们
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:layout_centerInParent="true"
或者,尝试将alignLeft和alignRight属性设置为同一参考点