I'm trying to set the position of imagebutton in center, but it doesn't work.
Now when I try to set it to center it goes nearly to right.
Can someone show me where I've made a mistake in my codes?
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#EBEBEB" >
<LinearLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:background="#EBEBEB" >
<ImageView
android:id="@+id/imagefield"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginTop="5dp"
android:src="@drawable/imagefield"
android:background="@null"/>
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:onClick="imagebutton1"
android:layout_alignBottom="@+id/imagefield"
android:layout_centerHorizontal="true"
/>
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imagebutton1"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
COPY PASTE BELOW CODE
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#EBEBEB" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#EBEBEB" >
<ImageView
android:id="@+id/imagefield"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@null"
android:src="@drawable/ic_action_chat" />
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:onClick="imagebutton1" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imagefield"
android:layout_alignTop="@+id/imagefield"
/>
</RelativeLayout>
</ScrollView>