Ich mag eine Aktivität erstellen, die in ihm Benutzer Statistiken für jeden Zustand sehen können, etwa wie folgt:Layout mit spezifischer Form
Zustand Aktivität Beispiel
Farbe eines jeden Staates ist basierend auf Statistiken und wenn der Benutzer auf jeden Status klickt, öffnet sich eine andere Aktivität. Mein Problem ist, wie man das erreicht? Ich kann 50 Fragmente erstellen, aber wie kann ich für jeden einzelnen eine bestimmte Form definieren (ähnlich einer Karte)? Scheint so, als hätte Google Map eine API, aber ich konnte keine gute Referenz finden.
Leider konnte ich keine richtige Implementierung für dieses Problem finden, das Beste, was ich tun konnte, ist so etwas wie diese:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.vira.as.testmap.MainActivity">
<ImageView
android:id="@+id/im1"
android:layout_width="135dp"
android:layout_height="320dp"
android:src="@drawable/california"/>
<ImageView
android:id="@+id/im2"
android:layout_width="200dp"
android:layout_height="370dp"
android:src="@drawable/nevada"
android:layout_marginStart="29dp"
android:layout_marginBottom="42dp"
android:layout_alignBottom="@+id/im1"
android:layout_alignParentStart="true" />
<ImageView
android:id="@+id/im3"
android:layout_width="125dp"
android:layout_height="200dp"
android:src="@drawable/arizona"
android:layout_marginBottom="128dp"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/im2"
android:layout_marginStart="88dp" />
</RelativeLayout>
Das Ergebnis ist das, was offensichtlich ineffizient ist und ein echtes Schmerz funktioniert aber mindestens: