72

DrawerLayout のジェスチャ認識を無効にするにはどうすればよいですか? (左から右にスワイプ)閉じるジェスチャー(右から左)のみを受け入れ、ホームボタンだけで引き出しを開きますか?

4

6 に答える 6

22

の場合setDrawerLockMode()、これはコード内にありますが、Android デベロッパードキュメントにはありません。

/**
 * The drawer is unlocked.
 */
public static final int LOCK_MODE_UNLOCKED = 0;

/**
 * The drawer is locked closed. The user may not open it, though
 * the app may open it programmatically.
 */
public static final int LOCK_MODE_LOCKED_CLOSED = 1;

/**
 * The drawer is locked open. The user may not close it, though the app
 * may close it programmatically.
 */
public static final int LOCK_MODE_LOCKED_OPEN = 2;
于 2014-04-08T17:48:05.283 に答える
4

DrawerLayout ジェスチャ認識を無効にするには、次を使用します。

mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);

次に、右から左へのスワイプを有効にするには、次のリソースを確認してください: http://android-journey.blogspot.com/2010/01/android-gestures.html

于 2013-07-12T07:26:52.517 に答える