PagerTitleStrip do not show titles on first display page, the titles are only drawn after swiping to another page
Asked Answered
N

2

12

Issue: After updating to appcompat-v7:23.0.0, both PagerTabStrip and PagerTitleStrip do not show titles on first display page (fig1), the titles are only drawn after swiping to another page (fig2).

Library used : appcompat-v7

Version used: 23.0.0

Theme used: Theme.AppCompat.Light.DarkActionBar,Theme.AppCompat.Light.NoActionBar

Devices/Android versions reproduced on: Nexus 5/ Android M Developer Preview 2

Steps to reproduce:

    1. Create a new sample project, minSdk version doesn't matter.
    1. Choose tabbed activity when asked to add an activity.
    1. Add a PagerTabStrip layout inside activity_main.xml such as below:

    <android.support.v4.view.PagerTabStrip
        android:id="@+id/title_strip"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top"
        android:paddingBottom="4dp"
        android:paddingTop="4dp"
        android:textColor="@android:color/background_dark" />
    

    1. Run the app

What to expect: titles on the viewpager tab strip should be visible What happened : The titles are not drawn (fig1) unless swiped to another page (fig2)

Here the link of the issue ...

https://code.google.com/p/android/issues/detail?id=183127

Nita answered 3/9, 2015 at 12:51 Comment(2)
I have the same issue.Polymerous
Right now the only workaround seems to be this: https://mcmap.net/q/528346/-how-can-we-work-around-the-blank-title-in-pagertitlestrip-and-pagertabstripSprang
P
3

I was having the same problem. This has been fixed in version 23.1.0. Update the library, clean the project and it should work.

Plant answered 19/10, 2015 at 15:8 Comment(0)
S
0

try this..

protected override void OnLayout (bool changed, int lValue, int tValue, int rValue, int bValue)
{
    for (int i = 0; i < ChildCount; i++) {
        if (GetChildAt (i).GetType () == typeof(TextView)) {
            ((TextView)GetChildAt (i)).Measure (MeasuredWidth, MeasuredHeight);
        }
    }
    base.OnLayout (changed, lValue, tValue, rValue, bValue);
}
Sair answered 22/10, 2015 at 15:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.