叠加视图不会禁用于底层视图操作 [英] Overlaying a view does not disable actions on underlying view

查看:412
本文介绍了叠加视图不会禁用于底层视图操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2次:查看A和B.查看观呈现并有行动,以输入的文本值。 IM显示一个覆盖视图​​ - 视图B在此之上。我预计,上查看的行动得到禁止,但他们没有和IM仍然能够在景观答:我怎样才能禁用此输入字段中键入?

I have 2 views : View A and view B. View A is rendered and has actions to input a text value. Im displaying an overlay view - View B on top of this. I expect that the actions on View A get disabled but they do not and im still able to type in the input field on View A. How can i disable this ?

推荐答案

原因是,你盖还没有消耗触摸事件,因此通过设计,如果一个视图不消耗事件传递给基础视图中的触摸事件视图模型。因此,从长远的答案是让你的叠加可触摸,可聚焦和触摸监听器和返回true。简短的回答是添加的android:点击=真正的您的重叠视图

The reason is that your overlay is not consuming the touch events , so by design if a view is not consuming touch events the events are passed to underlying view in the view model. So the long answer is make your overlay touchable, focusable , and touch listener and return true . short answer is add android:clickable="true" to your overlay view.

这篇关于叠加视图不会禁用于底层视图操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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