I am using A custom viewpager with a PagerTitleStrip, both supported by the android compatibility package. As recommended I use it like this:
<snok.stubefrie.DayPager
android:id="@+id/viewpager"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<android.support.v4.view.PagerTitleStrip
android:id="@+id/strip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"/>
</snok.stubefrie.DayPager>
However the titlestrip overlaps with the actual content of my viewpager (Both starting at 0,0). Any ideas?
How do you add views to ViewPager?
When I met the same problem, the cause was to add views with wrong position in my PagerAdapter implementation.
The bad code was like this.
This code had been working, however, when I began to use PagerTitleStrip, the PagerTitleStrip view became the first child of the ViewPager, hence
addView(view, 0)broke the internal structure of the ViewPager.It was fixed by replacing
addViewandremoveViewas below.Hope it helps!