Android,布局clicklistener和子视图点击问题
我有一个相对布局,我向其中添加按钮并将其 onCLickListener 设置为我处理其点击的当前活动。
在特定情况下,我还需要设置RelativeLayout onClickListener,但是一旦完成所需的布局单击,我需要允许再次单击按钮。 (即单击布局)
如果我将布局的单击侦听器设置为 null,我将无法再单击布局或其子视图的按钮。
我做错了什么?
编辑:我似乎已经通过设置修复了它;
relativeLayout.setClickable(false);
I have a RelativeLayout to which I add buttons and set their onCLickListener to the current Activity where I handle their clicks.
Under a particular circumstance I need to set the RelativeLayout onClickListener also, but then once finished with the required clicking on the layout, I need to allow clicking on the buttons again. (i.e. clicking throug hthe layout)
If I set the layout's click listener to null I can no longer click either the layout or the buttons that are it's child views.
What am I doing wrong?
EDIT: I seem to have fixed it by setting;
relativeLayout.setClickable(false);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你尝试过吗:
?
Have you tried:
?