TabHostでViewPagerを使用して、タブのタッチ/スワイプ効果でフラグメントを変更しています。しかし、問題は、スワイプジェスチャ中にフラグメント遷移の間にジャークが発生することです。何が問題なのですか?Support4Demosプロジェクトで使用され
ているFragmentTabsPagerクラスを使用しました。
質問する
1001 次
1 に答える
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>
于 2013-01-31T10:31:20.717 に答える