Android Fragment Tab寻呼机Jerk问题

时间:2013-01-30 07:45:43

标签: android android-fragments android-viewpager android-tabs

我使用 ViewPager TabHost 一起使用标签触摸/滑动效果更改片段。但问题是,我在滑动手势时在片段转换之间得到了Jerk。可能是什么问题呢?

我使用了支持4Demos 项目中使用的 FragmentTabsPager 类。

1 个答案:

答案 0 :(得分:0)

此问题已解决。 FragmentActivity .xml 文件中存在问题。请参阅下面的布局代码,并注意 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>
相关问题