2013-08-04 9 views
12

私のアプリに基づいてナビゲーションドロワーパターンを実装しようとしています。私はhereからサンプルコードをダウンロードして、それを実行し、引き出しが正常に機能する時間の90%を実行しましたが、それを開くときに引き出しが固まってしまうことがあります。私は状況を複製する方法を持っていますが、それは必ずしも機能しません。私は何ですか:サンプルを使用したAndroidのナビゲーションドロワーのバグ

1サンプルコードをそのまま実行します。
2 - 引き出しPEEKに指の
、3-離しますを取得し、時には通常の

引き出しとして引き出しを開くには、メインの断片に
、4-てみてください、それを押して左端に指を入れて指を右にスワイプして引き出しをもっと開いても、ピークモードにはまってしまいます。誰かがこの問題を抱えていたか/修正済みですか?

+2

可能な複製http://stackoverflow.com/questions/17896052/why-does-drawerlayout-sometimes-glitch-upon-opening/18086735#18086735 – paul

答えて

19

私は、あなたと同じような問題に直面しました。私は相対レイアウト(FILL_PARENT)の中にリストビューを持っていました。リストビューのコンテンツが少なく、リストビューの外にドラッグされたときはいつも、ナビゲーションドロワが壊れています。相対的なレイアウトにandroid:clickable="true"を設定すると、問題が解決されました。これが役立つことを願っています。あなたが提供されるナビゲーションドロワーの例のようなものを使用している場合は、ビジーの答えに明確にする

+0

あなたはandroid:clickable = "true"を親戚に設定しましたあなたはリストビューを持っているナビゲーションドロワーのレイアウト? – xlar8or

+2

メインのコンテンツを保持するために使用するレイアウトには、 'clickable =" true "を設定する必要があります。 – mato

16

:でframeLayoutにandroid:clickable="true"を追加

<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --> 
<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <!-- As the main content view, the view below consumes the entire 
     space available using match_parent in both dimensions. --> 
    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <!-- android:layout_gravity="start" tells DrawerLayout to treat 
     this as a sliding drawer on the left side for left-to-right 
     languages and on the right side for right-to-left languages. 
     The drawer is given a fixed width in dp and extends the full height of 
     the container. A solid background is used for contrast 
     with the content view. --> 
    <ListView 
     android:id="@+id/left_drawer" 
     android:layout_width="240dp" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:choiceMode="singleChoice" 
     android:divider="@android:color/transparent" 
     android:dividerHeight="0dp" 
     android:background="#111"/> 
</android.support.v4.widget.DrawerLayout> 

は、問題を修正するようです。

+1

私は 'LinearLayout'を使い、それも動作します。 :) – mato

関連する問題