添加按钮到SlidingDrawer处理? [英] Add button to a SlidingDrawer handle?

查看:204
本文介绍了添加按钮到SlidingDrawer处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在这方面的工作了一段时间。理念上手简单,我想在SlidingDrawer手柄上的按钮,允许用户查看特定抽屉的内容设置。所以我做了一个按钮的布局到一边,并将其设置为把手。抽屉吸引了罚款,但不会允许按钮(手柄)是pressed。当以往我尝试点击的东西,点击是PTED作为手柄点击跨$ P $,并切换抽屉的状态。

I've been working on this for a while. The Idea started simple, I wanted a button on a SlidingDrawer handle to allow the user to view settings specific to the content of the drawer. So I made a layout with a button off to the side and set it as the handle. The drawer drew fine, but would not allow the button (on the handle) to be pressed. When ever I try to click the thing, the click is interpreted as a handle click, and toggle the state of the drawer.

有谁知道怎么回事?

谢谢〜Aedon

推荐答案

您可以燮preSS的动作,国米$ P $点点击手柄上的按钮,一个开放与在SlidingDrawer元素的属性在布局的XML。像这样的:

You can suppress the action that interprets a click on the handle button as an "open" with an attribute in the SlidingDrawer element in the layout XML. Like this:

<SlidingDrawer android:layout_width="fill_parent"android:id="@+id/SlidingDrawer" android:handle="@+id/slideHandleButton"
                    android:content="@+id/txtHolder" android:layout_height="fill_parent"
                    android:orientation="horizontal" android:allowSingleTap="false">

只要在安卓allowSingleTap =假然后,只需执行一个click处理像通常那样的按钮。这将停止从开/关抽屉,但您可能需要拦截事件的按钮,让它做你想做的事情。

Just make the android:allowSingleTap="false" Then just implement a click handler for the button like you normally would. This will stop it from opening/closing the drawer, but you might need to intercept the events for the button to get it to do what YOU want it to do.

这篇关于添加按钮到SlidingDrawer处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆