Disable and enable view android

限于喜欢 提交于 2019-11-29 08:43:53

Yes you can switch between the receivers of touch events by returning false in your onTouchEvent, this should propagate event to the next view.

UPD: The code should be something like this:

@Override
public boolean onTouchEvent(MotionEvent event) {
if (!isTouchable) return false;
// your DrawerView logic
}

where isTouchable is a boolean variable which should be false is you don't want to draw on your view and true if you want to draw.

You can enable or disable click on your drawing overlay:

findViewById(R.id.custView).setClickable(true/false);

While your drawing overlay is not clickable, you will be able to interact with the map.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!