Robin Dijkhof
Robin Dijkhof

Reputation: 19278

Android PagerTabStrip text disappearing

Since a day my PagerTabStrip text is disappearing.

enter image description here

The text is only half vissible and disappears when i foccus on my editText?

I did not change my xml file, but this is how it looks.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" 
tools:context="robin.activity.MainFragmentActivity">

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

    <android.support.v4.view.PagerTabStrip
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:paddingBottom="10dp"
        android:paddingTop="10dp"
        android:textColor="#000000" />

</android.support.v4.view.ViewPager>

</RelativeLayout>

I did update some google libraries, but did not change my build.grade nor updated my sdk22. Anyway these are my dependencies:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:recyclerview-v7:+'
    compile files('libs/mpandroidchartlibrary-2-1-3.jar')
    compile files('libs/gson-2.3.1.jar')
}

What could be my problem?

EDIT: I created multiple projects all with the same problem.

EDIT2: Even on old version doed the same thing. I guess this must be a lib problem?

EDIT#: Wierd enoug it is a google issue. https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=183127

I did not change my gradle. How to solve this?

Upvotes: 1

Views: 883

Answers (3)

drindt
drindt

Reputation: 899

My temporary solution is:

pager.postDelayed(new Runnable() {
    @Override
    public void run() {
        pager.setCurrentItem(1);
        pager.setCurrentItem(0);
    }
}, 500);

This lets the ViewPager switch between the first and second fragment. The text comes back after this. Also adjust the layout_height from PagerTabStrip to ~40dp instead of wrap_content. After a new release which fixes the issue simply rollback this change in your favorite VCS.

Upvotes: 2

Robin Dijkhof
Robin Dijkhof

Reputation: 19278

So I found a solution. I added the PagerStip from appcompat v22 and used that one. Check this link

Upvotes: 1

aglour
aglour

Reputation: 924

I've had the same problem with support library 23.0.0.

My fix was to replace the PagerTabStrip for the "TitlePageIndicator" of Jake Wharton's View pager indicator library. https://github.com/JakeWharton/ViewPagerIndicator

Upvotes: 0

Related Questions