有办法将loadListener附加到MapView小部件上吗?
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>爪哇:
mapView = (MapView) findViewById(R.id.mapview);
mapView. // attach listeners?发布于 2011-03-31 15:40:35
您只需编写一个方法,为要在创建它之后附加的MapView创建侦听器,然后让它接受要将侦听器附加到的映射。
有点像
public void attachMapViewListeners (MapView mapView){
//Attach your listeners here
}然后使用需要附加所有侦听器的MapView调用它。
编辑
现在我完全明白你想做的事了。
因此,您需要侦听onFinishInflate()事件。
如果您想要更详细的Android开发视图,请在这里提供更多
https://stackoverflow.com/questions/5502443
复制相似问题