Google Maps APIにポップアップバブルを作成しようとしています。ここに私がしたいことがあります。私がA点からB地点に向かって走っているとしましょう。地点Aから地点Bに向かう途中で、私がその特定の地域の近くにいるときに人気のある場所をポップアップバブルで表示したいと思います。 ?ありがとうGoogle Maps APIでポップアップバブルを作成する
0
A
答えて
0
現在のところ、機能やビューはありませんが、独自のカスタムメニューを簡単に作成できます。たとえば、カスタム背景を持つTextView
を作成し、それをGoogleマップの断片の上に置くだけです。
は、フラグメントの上にビューを配置するには、あなたはそうのような、そのようRelativeLayout
として、レイアウトにフラグメントを配置する必要があります:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.akashbhave.locomoto.MapsDemo">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.akashbhave.locomoto.MapsDemo" />
<TextView
android:layout_width="100dp"
android:layout_height="60dp"
android:id="@+id/infoView"
android:textSize="14sp"
android:textColor="#000000"
android:background="@drawable/infoViewLayout"
android:gravity="center_vertical|center_horizontal"
android:paddingRight="7dp"
android:paddingLeft="7dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"/>
</RelativeLayout>
その後、持っているXMLファイルを作成することができます私が上記のようにあなたの背景として設定します。
ユーザーが一般的な場所に来たときはいつでも(Javaコードで確認できます)、infoView
を表示するか、ユーザーが残しておくと表示されなくなります。例は次のようになります。
// Check distance to locations here (possible through loc1.distanceTo(loc2))
if(distance < targetDistance) {
infoView.setVisibility(View.VISIBLE);
else {
infoView.setVisibility(View.INVISIBLE);
}
あなただけの迅速なポップアップを表示したい場合は、あなたがそうのように、Toast
を使用することができます。それについてです
Toast.makeText(MapsDemo.this, "You are near" + locationName, Toast.LENGTH_LONG).show();
!それが役に立てば幸い!
関連する問題
- 1. インタラクティブInfoWindow Google Maps APIを作成する
- 2. Google Maps APIの偽のテストレスポンスを作成
- 3. Maps APIをV3:Google MapsのAPI V3で
- 4. Google Maps API自動完成
- 5. Google Maps APIとGoogle Maps Engine?
- 6. Google Maps Data APIとGoogle Maps API
- 7. Google Maps API V3スクリプトを動的に作成する
- 8. Google Maps API v3でマーカーを作成できません...
- 9. google api infoWindow google maps api
- 10. Google Maps Android API v2で新しいロケーションソースを作成
- 11. Google Maps APIでLatとLongから新しいポイントを作成
- 12. 新しいGoogle Maps APIプロジェクトを作成できません
- 13. フローティングマーカーを作成するGoogle Maps iOS
- 14. google maps api
- 15. Google Maps Autocompletion API
- 16. Google Maps API - ロケーションファインダ
- 17. Google Maps APIバウンドエラー
- 18. GeoLocation + Google Maps API?
- 19. google maps api
- 20. Google Maps Directions API
- 21. Google Maps API
- 22. Google Maps APIメール
- 23. Google Maps API RefererNotAllowedError
- 24. Google Maps API + Jquery
- 25. Google Maps API - マーカー
- 26. Google Mapsエラー:Google Maps APIエラー:MissingKeyMapError
- 27. Angular2-google-mapsでhtml-markerを作成
- 28. デスクトップアプリケーションでGoogle Maps APIを使用する
- 29. Google Maps APIをカスタムタイルで使用する
- 30. Meteor.jsでGoogle Maps APIを使用する