Jay*_*ayo 9 android google-maps
我正在使用这个例子:https://github.com/galex/android-mapviewbalons
我的问题是可点击区域比标记本身宽.例如,我的Google地图标记是25x25,然后可点击区域将扩展到70x70.这是重叠标记的一个大问题.
当我点击该箭头的尖端时,即使点击区域远离标记,也会激活onTap.
请帮我.谢谢.
Ren*_*eno -1
用于调试:
尝试使用 aTouchDelegate作为视图,您可以为给定指定触摸矩形View
显示如何使用的示例TouchDelegate:
public class TouchDelegateSample extends Activity {
Button mButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.touch_delegate_view);
mButton = (Button)findViewById(R.id.delegated_button);
View parent = findViewById(R.id.touch_delegate_root);
// post a runnable to the parent view's message queue so its run
after
// the view is drawn
parent.post(new Runnable() {
@Override
public void run() {
Rect delegateArea = new Rect();
Button delegate = TouchDelegateSample.this.mButton;
delegate.getHitRect(delegateArea);
delegateArea.top -= 200;
TouchDelegate expandedArea = new TouchDelegate(delegateArea,
delegate);
// give the delegate to an ancestor of the view we're
delegating the
// area to
if (View.class.isInstance(delegate.getParent())) {
((View)delegate.getParent()).setTouchDelegate(expandedArea);
}
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
查看给定的生命值是否在项目标记的范围内。覆盖以修改项目的命中测试方式。命中点是相对于标记的边界的。默认实现只是检查击中点是否在标记的可触摸范围内。
| 归档时间: |
|
| 查看次数: |
1891 次 |
| 最近记录: |