在 pagerSlidindTabStrip 中,Moto G 4+ 的文本显示不完整 android 7
In pagerSlidindTabStrip text display incomplete for Moto G 4+ android 7
在我的项目中,我使用了 PagerSlidingTabStrip 库。现在在所有其他设备中,它在 PagerSlidingTabStrip 中显示正确的文本。但在 Moto G 4+ 中,它在 PagerSlidingTabStrip 中显示不完整的文本。喜欢它只显示 "Entertain” instead "娱乐”。需要改变什么,请帮助我。提前致谢。
<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);
}
现在的画面是这样
添加tabs.setDistributeEvenly(假);
通过对代码进行一些更改,它现在可以完美运行。可能对将来的某个人有所帮助,所以 post 此处 changes.I 对 xml 文件进行了如下更改。
app:pstsShouldExpand="false"
它将正常工作。
在我的项目中,我使用了 PagerSlidingTabStrip 库。现在在所有其他设备中,它在 PagerSlidingTabStrip 中显示正确的文本。但在 Moto G 4+ 中,它在 PagerSlidingTabStrip 中显示不完整的文本。喜欢它只显示 "Entertain” instead "娱乐”。需要改变什么,请帮助我。提前致谢。
<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);
}
现在的画面是这样
添加tabs.setDistributeEvenly(假);
通过对代码进行一些更改,它现在可以完美运行。可能对将来的某个人有所帮助,所以 post 此处 changes.I 对 xml 文件进行了如下更改。
app:pstsShouldExpand="false"
它将正常工作。