1 pièce(s) jointe(s)
RelativeLayout: Problème placement circulaire
Bonjour à tous,
je cherche à placer 9 images équidistantes en forme de cercle grâce à un relativelayout comparé à un centre.
J'ai presque réussi mais les 2 dernières images ne peuvent pas être placée correctement (cf. image avec l'avant dernière)
Ci-dessous, le code xml:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/center"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerInParent="true"
android:background="#FFFF0000"
/>
<ImageView
android:id="@+id/center_top_a_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_above="@id/center"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:background="#FF00FF00" />
<ImageView
android:id="@+id/bottom_left_a_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#FF00FF00"
android:layout_below="@id/center"
android:layout_toLeftOf="@id/center"
android:layout_marginRight="40dp"
android:layout_marginTop="50dp"
/>
<ImageView
android:id="@+id/bottom_right_a_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#FF00FF00"
android:layout_below="@id/center"
android:layout_toRightOf="@id/center"
android:layout_marginLeft="60dp"
android:layout_marginTop="50dp"
/>
<ImageView
android:id="@+id/center_top_b_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_toLeftOf="@id/center"
android:layout_above="@id/center"
android:layout_marginBottom="20dp"
android:layout_marginRight="40dp"
android:background="#FF00FF00" />
<ImageView
android:id="@+id/center_top_c_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_above="@id/center"
android:layout_toRightOf="@id/center"
android:layout_marginBottom="20dp"
android:layout_marginLeft="40dp"
android:background="#FF00FF00" />
<ImageView
android:id="@+id/center_left_b_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_toLeftOf="@id/center"
android:layout_below="@id/center"
android:layout_marginBottom="1dp"
android:layout_marginRight="50dp"
android:background="#FF00FF00" />
<ImageView
android:id="@+id/center_right_b_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_toRightOf="@id/center"
android:layout_below="@id/center"
android:layout_marginBottom="1dp"
android:layout_marginLeft="50dp"
android:background="#FF00FF00" />
<ImageView
android:id="@+id/center_right_c_1"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_below="@+id/center"
android:layout_marginBottom="60dp"
android:layout_marginLeft="2dp"
android:layout_toRightOf="@+id/center"
android:background="#FF00FF00" />
</RelativeLayout> |
Quelqu'un sait comment corriger ça?
Merci d'avance,
Nicolas