0

の問題を見つけるのに何時間も費やしましたActionBarDrawerToggleが、問題はメイン レイアウトにあります。

問題が何であるかを示しましょう。

これは、アプリケーションの開始後の初期の様子の例です。

ここに画像の説明を入力

ご覧のとおり、ハンバーガーは存在しますが、現在は表示されていません。
ドロワーメニューをスワイプすればより表示されます。

ここに画像の説明を入力

あるべき姿に見えますが、invalidateOptionsMenu()呼び出されたときなどに突然消えることがあります。

だから私はトグルの問題を見つけようとしましたが、それは私のレイアウトにあります

これが私のレイアウトxmlファイルです。

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/navigation_drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/linear_layout_main_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar_main"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?attr/colorPrimary"
                android:minHeight="?attr/actionBarSize"
                android:visibility="gone"
                app:theme="@style/MainAppTheme.ToolbarMain"
                app:titleTextAppearance="@style/MainAppTheme.Toolbar.Title" />
        </LinearLayout>

        <ViewStub
            android:id="@+id/stub_progress_bar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:inflatedId="@+id/progress_bar_buttons"
            android:layout="@layout/view_stub_progressbar_bg" />
    </FrameLayout>

    <ScrollView
        android:id="@+id/frame_layout_drawer_left"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fillViewport="true">

    </ScrollView>

    <ScrollView
        android:id="@+id/frame_layout_drawer_right"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_gravity="end"
        android:fillViewport="true" />
</android.support.v4.widget.DrawerLayout>

問題は最後ScrollViewにあり、最後/右のスクロール ビューがなくてもすべて正常に動作します。ちなみに、このレイアウトは引出しが 2 つある場合でも問題なく動作しますが、この場合はハンバーガーだけが欠けています。
問題は、ナビゲーション ドロワー トゥーグルが 2 つのナビゲーション ドロワー ビューと競合することだと思います。
グラビティ エンドのビューがどのようなものであるかは問題ではないため、この場合はハンバーガーを表示しません (グラビティ エンドのビューが存在する場合)。

この問題を解決するのを手伝ってください。対処方法がわからないため、とにかく 2 つの引き出しが必要です。

どんな助けでも大歓迎です、ありがとう。

4

1 に答える 1