【问题标题】:Android: touch items behind navigation drawerAndroid:导航抽屉后面的触摸项目
【发布时间】:2018-02-12 20:38:17
【问题描述】:

我的布局中有一个导航抽屉(android.support.v4.widget.DrawerLayout)和一个按钮。

当抽屉打开时,我不能直接触摸按钮(因为它在抽屉后面的布局中)。我必须点击其他地方,抽屉会关闭(这是正常的),我可以点击按钮。

我想要的是,当抽屉打开时,我希望后面的按钮在不关闭抽屉的情况下仍然可以点击

==

这是我的布局(经典抽屉布局)

<android.support.v4.widget.DrawerLayout
    ...>

        <FrameLayout...>
            <android.support.constraint.ConstraintLayout...
                    <Button /> ---> here is my button
            </android.support.constraint.ConstraintLayout>
        </FrameLayout>

        <LinearLayout
            android:orientation="vertical" /> --> here is my drawer

    </android.support.v4.widget.DrawerLayout>
</layout>

我怎样才能做到这一点?谢谢。

【问题讨论】:

  • 能详细解释一下吗?
  • @Mohammad Ali 我发布了布局
  • 当你点击按钮然后抽屉打开时,你再点击按钮然后抽屉关闭时你需要多少分钟??
  • @Mohammad Ali 不,默认行为是,当抽屉打开并且您想单击后面的按钮时,抽屉将关闭。我想在不关闭抽屉的情况下点击后面的按钮。
  • u min 打开抽屉时间你想在不关闭抽屉的情况下单击按钮后面的抽屉?

标签: android


【解决方案1】:

覆盖导航抽屉或尝试滑动窗格布局

【讨论】:

  • 如何让抽屉后面+抽屉里的东西同时点击?
  • 您需要从抽屉布局新类扩展并覆盖方法 onTouchEvent,如果您在 IDE 上的 DrawerLayout 上“ctrl+click”,它会向您打开此视图的源代码。
  • 和我想要的无关
  • 您将使用自定义规则制作自己的抽屉,当您单击不在抽屉面板中时它不会关闭
猜你喜欢
  • 2013-07-04
  • 2020-12-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-08
  • 2020-12-06
  • 1970-01-01
相关资源
最近更新 更多