简体   繁体   中英

Android Fragment Tab Pager Jerk Issue

I am using ViewPager with TabHost to change fragments with tab touch/swipe effect . But the problem is, I am getting Jerk between fragments transition while swipe gesture. What could be the problem?

I have used FragmentTabsPager class which is used in Support4Demos project.

This issue is resolved. There was issue in .xml file of the FragmentActivity . See the layout code below and watch out for comment at the declaration of LinearLayout .

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" <!-- Replacing layout_height="match_parent" resolved my issue-->
        android:orientation="vertical" >

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0" >
        </TabWidget>

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="0" />

        <android.support.v4.view.ViewPager
            android:id="@+id/viewPager"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />
    </LinearLayout>
</TabHost>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM