首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MapView loadListener

MapView loadListener
EN

Stack Overflow用户
提问于 2011-03-31 15:36:22
回答 1查看 642关注 0票数 0

有办法将loadListener附加到MapView小部件上吗?

XML:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"
        android:layout_weight="2"
        >

        <com.google.android.maps.MapView
            android:id="@+id/mapview"
            android:layout_weight="1"
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent"
            android:clickable="true" 
            android:apiKey="my api key" />

</LinearLayout>

爪哇:

代码语言:javascript
复制
mapView = (MapView) findViewById(R.id.mapview);
mapView.  // attach listeners?
EN

回答 1

Stack Overflow用户

发布于 2011-03-31 15:40:35

您只需编写一个方法,为要在创建它之后附加的MapView创建侦听器,然后让它接受要将侦听器附加到的映射。

有点像

代码语言:javascript
复制
public void attachMapViewListeners (MapView mapView){
    //Attach your listeners here
}

然后使用需要附加所有侦听器的MapView调用它。

编辑

现在我完全明白你想做的事了。

因此,您需要侦听onFinishInflate()事件。

如果您想要更详细的Android开发视图,请在这里提供更多

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5502443

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档