AndroidアプリでGoogleマップを表示しています。ユーザーが地図をダブルクリックしたときにズームインしたい。
Map を表示するための xml があります
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.is.guide.ExtMapView
android:id="@+id/tourMapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="@string/apikey" />
そしてクラスは次のように
public class ExtMapView extends MapView {
private Context context;
private GestureDetector gestureDetector;
@SuppressWarnings("deprecation")
public ExtMapView(Context c, AttributeSet attrs) {
super(c, attrs);
context = c;
gestureDetector = new GestureDetector((OnGestureListener) context);
gestureDetector.setOnDoubleTapListener((OnDoubleTapListener) context);
}
public boolean onTouchEvent(MotionEvent ev) {
if (this.gestureDetector.onTouchEvent(ev))
return true;
else
return super.onTouchEvent(ev);
}
}
アプリの実行中にview.InflateExceptionを取得します:(
私が見逃したかもしれないものは何ですか?
以下の例外
12-07 21:26:09.788: E/AndroidRuntime(6714): java.lang.RuntimeException:
Unable to start activity ComponentInfo{com.is.guide/com.is.TourMapActivity}:
android.view.InflateException: Binary XML file line #7: Error inflating class
com.is.guide.ExtMapView
12-07 21:26:09.788: E/AndroidRuntime(6714): Caused by: android.view.InflateException:
Binary XML file line #7: Error inflating class com.is.guide.ExtMapView
このリンクを参照しました http://dev.kafol.net/2011/11/how-hard-is-it-to-make-simple-zoom-in.html