【发布时间】:2014-10-15 01:21:45
【问题描述】:
我只想在我的操作栏中显示标签,所以我以编程方式隐藏标题和主页图标
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" />
【问题讨论】:
标签: android tabs android-actionbar landscape