孩子在父视图之外不可点击 [英] Children not clickable outside parent view

查看:51
本文介绍了孩子在父视图之外不可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有标记的地图视图.看看下面这张图:
Grandparent 是一个填充视图
Parent 是我的 MarkerView
Child 是一个可点击的标记

I have a created a mapview with markers on it. Looking at this picture below:
Grandparent is a filling View
Parent is my MarkerView
Child is a marker which is clickable

父级有 clipChildren(false),因此子级是可见的.

Parent has clipChildren(false) and thus the children are visible.

我的问题是孩子是可点击的,除了Child 2Parent 之外的部分.Parent 也有适当的 TouchDelegate(我也为孩子们试过这个).

My problem is that the children are clickable, except for the part where Child 2 is outside the Parent. Parent also has the appropriate TouchDelegate (and I also tried this for the children).

如何使完整的子项可点击?

How can I make the complete child clickable?

推荐答案

如果不更改元素,我无法让它工作.
我最终扩大了父级并使用 setTranslationY 作为标记以将它们保持在这样的位置:

I couldn't make it work without changing the elements.
I ended up enlarging the parent and using setTranslationY for the markers to keep them in place like this:

这篇关于孩子在父视图之外不可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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