1

Androidサポートパッケージv4と次のレイアウトを使用して、スクロール可能なタブバー+対応するスライド可能なコンテンツビューを表示しています:

<?xml version="1.0" encoding="utf-8"?>
<TabHost
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    <LinearLayout
                android:orientation="horizontal"
                android:layout_width="fill_parent"
                android:gravity="center_vertical"
                android:layout_height="wrap_content">
        <HorizontalScrollView
                            android:layout_width="wrap_content"
                            android:id="@+id/horizontalScrollView"
                            android:orientation="horizontal"
                            android:layout_height="wrap_content"
                            android:fillViewport="true"
                            android:scrollbars="none">
            <TabWidget
                    android:id="@android:id/tabs"
                    android:orientation="horizontal"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

        </HorizontalScrollView>
    </LinearLayout>
    <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="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/>
</LinearLayout>
</TabHost>

それはうまく機能しますが、90% と言えますが、10% は UI を再描画しません。要素を無効にしても問題は解決しません。最も奇妙な部分: 電話をロックして再ロックした後、すべてが期待どおりに表示され、魔法のように機能します。

例: 新しいタブ + フラグメントを追加します。- Tab + Fragment が追加され、それらのすべてのメソッドが呼び出されますが、UI は真っ黒です。ロック+ロック解除=すべてが再び問題ありません。

フラグメントでのユーザー入力の処理。(写真参照) フラグメントのユーザー入力

注意: すべての要素の無効化を既にテストしましたが、機能しません。

この問題を解決するために他に何ができますか?

前もって感謝します

4

1 に答える 1

0

タブホストでメモリリークが発生しました。

于 2012-03-07T02:26:49.727 に答える