开发者

MapView loadListener

Is there a way to attach a loadListener to the MapView widget?

XML:

<?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>

Java:

mapView = (MapView) 开发者_StackOverflowfindViewById(R.id.mapview);
mapView.  // attach listeners?


You could just write a method that creates the listeners for the MapView that you want to attach after you create it, and just have it take the mapview to attach the listener to.

Something like

public void attachMapViewListeners (MapView mapView){
    //Attach your listeners here
}

Then just call that with the MapView that needs all of the listeners attached.

Edit

Now I get exactly what you are trying to do.

So you will want to listen for the onFinishInflate() Event.

More here if you want specifics Android Dev View

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜