Android 플랫폼의 Google지도에서 내 아이콘에 대한 맞춤 툴팁을 만들려고합니다.Android : 맞춤 툴팁의 버튼 클릭 이벤트
나는 몇 가지 물건을 시도하고 이것이 내가 지금 가지고있는 것입니다.
의 Inflater 클래스 : 마커에
이private class InfoHandler implements GoogleMap.InfoWindowAdapter, View.OnClickListener {
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
View v = layoutInflater.inflate(R.layout.tooltip_brewer, null);
TextView tvLat = (TextView) v.findViewById(R.id.tv_title);
TextView tvLng = (TextView) v.findViewById(R.id.tv_snippet);
Button button = (Button) v.findViewById(R.id.btn_button);
tvLat.setText("TestTooltip");
tvLng.setText("TestTooltip 1");
button.setOnClickListener(this);
return v;
}
@Override
public void onClick(View view) {
Log.d(Constants.TAG, "Test 01");
}
}
연결 :
public void setInfoWindow(LayoutInflater inflater) {
this.layoutInflater = inflater;
map.setInfoWindowAdapter(new InfoHandler());
}
툴팁 XML :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_snippet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="snippet" />
</LinearLayout>
<Button
android:id="@+id/btn_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
지금 모든 작품은 내가 클릭 이벤트가 작업을 얻을 수 없습니다 을 받아 도구 설명의 버튼. 누군가가 그 해결책을 가지고 있습니까?
가능한 중복 http://stackoverflow.com/questions/14123243/google- maps-api-v2-custom-infowindow-like-original-android-google-maps) – matiash