Fügen Sie MapFragment eine benutzerdefinierte Schaltfläche mit dem gleichen Stil der Maps-App hinzu
Ich muss meinem MapFragment einige benutzerdefinierte Schaltflächen hinzufügen.
Ich benutze diesen Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<!--suppress AndroidDomInspection -->
<fragment
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true">
<ImageButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10sp"
android:layout_marginTop="10sp"
android:src="@android:drawable/ic_menu_mylocation"/>
<ImageButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="60sp"
android:layout_marginTop="10sp"
android:src="@android:drawable/ic_menu_mylocation"/>
</RelativeLayout>
Ich würde mir wünschen, dass diese Schaltflächen den gleichen Stil wie die Zoom-Schaltflächen haben: weißer halbtransparenter Hintergrund, grauer Rand und grauer Hintergrund beim Klicken.
Wie kann ich den gleichen Stil einstellen? Gibt es einen einfacheren Weg? (zum Beispiel offizielle API)