Android ActionBar tabs in terrain do not take up full width

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

    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. Bookmarks take full width space.

enter image description here

But if I switch to landscape mode, the tabs take up about 40% of the width.

enter image description here

I want to expand the tabs in landscape mode just like in portrait mode. I tried a lot but couldn't find a solution. Is it possible or just one way to use TabHost?

Edit: My pager layout is:

<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" /> 

      

+3


source to share


1 answer


Can you show the related pager part in the XML file (s)? Here are some tips 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 the same breakpoint.

0


source







All Articles