I need an Arrow to be at the Top Center of my Android Screen
For whatever reason the following layout places the arrow in the top left of the screen and I would like it centered horizontally and at the top
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
开发者_StackOverflow社区
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
>
<com.google.android.maps.MapView
android:id="@+id/map2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:apiKey="0bjRuqXOuK5dP5guXo0LV5aUbn_s-aYzsmeuawA"
android:clickable="true"
/>
<edu.elon.ecs.GreenArrow
android:id="@+id/greenarrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:src="@drawable/greenarrow"
/>
</RelativeLayout>
</LinearLayout>
try this
<edu.elon.ecs.GreenArrow
android:id="@+id/greenarrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:gravity="center"
android:src="@drawable/greenarrow"
/>
精彩评论