在pagerSlidindTabStrip文本显示不完整的Moto G 4+ android 7

时间:2017-03-28 12:54:22

标签: android android-7.0-nougat pagerslidingtabstrip

在我的项目中,我在所有其他设备中使用了PagerSlidingTabStrip库。现在它在PagerSlidingTabStrip中显示正确的文本。但在Moto G 4+中,它在PagerSlidingTabStrip中显示不完整的文本。喜欢它只显示“娱乐”而不是“娱乐”。什么需要改变,PLZ帮助我。在此先感谢。

 <com.astuetz.PagerSlidingTabStrip
        android:id="@+id/VideoTabs"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@color/toolbar_color"
        android:paddingLeft="11dp"
        android:layout_marginRight="0dp"
        android:paddingRight="0dp"
        android:textSize="15sp"
        app:pstsActivateTextColor="@color/white"
        app:pstsDeactivateTextColor="@color/white"
        app:pstsDividerColor="@color/toolbar_color"
        app:pstsIndicatorHeight="0dp"
        app:pstsTabBackground="@color/toolbar_color"
        app:pstsTextAllCaps="false"
        app:pstsUnderlineHeight="0dp"
        android:layout_toLeftOf="@+id/ivNextFragment"/>

在java文件中

   public void init(View rootview) {
      tabs = (PagerSlidingTabStrip) rootview.findViewById(R.id.VideoTabs);
      mTabsLinearLayout = ((LinearLayout) tabs.getChildAt(0));

      pager = (ViewPager) rootview.findViewById(R.id.viewpager);
     //        tabs.setShouldExpand(true);
     pager.setOffscreenPageLimit(listPublisherName.size());

     setupViewPager(pager);
     tabs.setViewPager(pager);
     tabs.setForegroundGravity(Gravity.CENTER);
     pager.setCurrentItem(0);
     tabs.setTabSwitch(true);

     TextView tv = (TextView) mTabsLinearLayout.getChildAt(pos);
     tv.setTextSize(16);
     tv.setTypeface(null, Typeface.BOLD);
   }

屏幕就像这样enter image description here

2 个答案:

答案 0 :(得分:0)

添加tabs.setDistributeEvenly(false);

答案 1 :(得分:0)

通过对代码进行一些更改,它现在可以正常工作。可能是它将来帮助一些人所以发布此处更改。我在xml文件中进行了如下更改。

 app:pstsShouldExpand="false"

它会正常工作。