Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
379 views
in Technique[技术] by (71.8m points)

android - How can we work-around the blank title in PagerTitleStrip and PagerTabStrip?

There's an issue with PagerTitleStrip and PagerTabStrip with support-v4 (version 23.0.0).

The title views of a ViewPager when using PagerTitleStrip or PagerTabStrip and the version 23.0.0 (for Marshmallow/Android 6.0 support) of the support-v4 library doesn't render correctly.

Issue is tracked and scheduled for Future Release on: https://code.google.com/p/android/issues/detail?id=183127 https://code.google.com/p/android/issues/detail?id=184715

Update: This have now been resolved, in 23.1.0.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

An interim solution while waiting for a patched release is to use a copy of the latest known good version of these classes (22.1.0) instead of the one bundled with the support library.

Drop the attached files into your project and setup your ViewPager with these classes instead.

Note: do not change their package name as they rely on package protected classes in the support library.

Example using our "new" PagerTabStrip class:

      <android.support.v4.view.ViewPager
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="match_parent"
          android:layout_height="wrap_content">   
          <android.support.v4.view.PagerTabStripV22
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="top"/>   
      </android.support.v4.view.ViewPager>

PagerTitleStripV22.java

PagerTabStripV22.java


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...