こんにちは、マップ上に円形を作成しようとしています。そのために、グラウンド オーバーレイ アイテムを使用しています。drawable xmlファイルで円を描いてみました。最初に通常のアクティビティ レイアウトで試したところ、完全な円の形が表示されました。私が地図に描こうとしたのと同じものは、楕円形のように見えます。ドローアブルとレイアウトの私のコードは次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#666666"/>
<size
android:width="120dp"
android:height="120dp"/>
</shape>
そして私のレイアウトファイル:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<RelativeLayout
android:id="@+id/circleLay"
android:layout_height="100dp"
android:layout_width="100dp"
android:layout_centerInParent="true"
android:background="@drawable/circle">
</RelativeLayout>
</RelativeLayout>
次のようにグラウンドオーバーレイアイテムを作成しようとしました:
LatLng NEWARK = new LatLng(0, 0);
View markerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.custom_marker_layout, null);
GroundOverlayOptions newarkMap = new GroundOverlayOptions()
.image(BitmapDescriptorFactory.fromBitmap(createDrawableFromView(this, markerView)))
.position(NEWARK, 860000f, 650000f);
GroundOverlay imageOverlay = googleMap.addGroundOverlay(newarkMap);
円を表示するアクティビティで試したのと同じことですが、マップでは円ではなく楕円形を示しています。これを行う方法?助けが必要。ありがとうございました。