4

I want to show only tabs in my action bar, so i hide title and home icon programatically

    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);

Everything works fine in portrait mode. Tabs occupy full space of width.

enter image description here

But if I switch to the landscape mode, tabs occupy approximatelly 40% of width.

enter image description here

I want to expand tabs in landscape mode exactly like in portrait mode. I tried a lot of things, but I didn't find any solution. It is possible or only one way is to use TabHost?

Edit: My pager layout:

<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" /> 
user1247373
  • 173
  • 1
  • 11

1 Answers1

0

Can you show the related part with pager in you XML file(s)? Here are some suggestions that you can apply to them;

android:layout_width="match_parent"

android:gravity="center_horizontal"

android:layout_centerInParent="true"

Or, try setting both alignLeft and alignRight attributes to same reference point.

Faruk Yazici
  • 2,344
  • 18
  • 38