首页 \ 问答 \ 为什么人们使用setTimeout(“func()”,...)而不是setTimeout(func,...)(Why do people use setTimeout(“func()”, … ) instead of setTimeout(func, … ))

为什么人们使用setTimeout(“func()”,...)而不是setTimeout(func,...)(Why do people use setTimeout(“func()”, … ) instead of setTimeout(func, … ))

我看到这使用了很多,我被告知在引号之间放置函数引用是不好的,因为setTimeout / setInterval evals了引用。 这两者之间的实际差异是什么,一个用于另一个,为什么我会这么频繁地使用它,即使应该是常识,这种方式是坏的?


I see this used a lot and I was told putting the function reference between quotes was bad because setTimeout/setInterval evals the reference. What is the actual difference between these two such that one is used over the other and why do I see this used so frequently even though it should be common knowledge that this one way is bad?


原文:https://stackoverflow.com/questions/11622808
更新时间:2022-04-13 06:04

最满意答案

尝试使用MapView ,它只是几个Map对象之一

显示地图的视图(使用从Google地图服务获取的数据)。 聚焦时,它将捕获按键和触摸手势以移动地图。

此类的用户必须将包含此视图的Activity或Fragment中的所有生命周期方法转发到此类中的相应方法。

对于实际代码检查谷歌地图android样本在Github。


Try using MapView which is just one of the several Map Objects.

A View which displays a map (with data obtained from the Google Maps service). When focused, it will capture keypresses and touch gestures to move the map.

Users of this class must forward all the life cycle methods from the Activity or Fragment containing this view to the corresponding ones in this class.

For actual codes checkout the Google maps android samples in Github.

相关问答

更多
  • 你肯定应该使用v3 - 其他的已被弃用,在某些时候将不受支持,甚至可能无法使用。 来自https://developers.google.com/maps/documentation/javascript/places : Places服务包含在一个独立的库中,与主要的Maps API JavaScript代码分开。 您只需要包含另一个脚本引用以获取其他位置库,它包括“场所自动完成”。