Hi i manage to make the icon center same line with the text in linear view, but I wanna add in a arrow image at the right side so i have to switch to relative view. As shown in the image, I can't manage to set the relative view left icon look like linear view.
EDIT
I want to arrow icon stay on the right.

Left image is linear, right is relative.
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layercontainer"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp">
<ImageView android:id="@+id/categoryIcon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<TextView android:id="@+id/categoryTitle"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/categoryIcon"
android:textStyle="bold"
android:textSize="22dp"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<ImageView
android:id="@+id/nextIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"/>
</RelativeLayout>
I suggest using the TextView properties drawableLeft and drawableRight
android:drawableLeft="@drawable/whatever"
android:drawableRight="@drawable/arrow"
android:width="fill_parent"
That way and setting the TextView's gravity to center, everything should be ok
Also, using a single TextView instead of a RelativeLayout + 3 views is a big improvement in simplicity. Anyway, if you were to stick to 3 views, using LinearLayout instead of RelativeLayout is a good advice.
Why can't you use a LinearLayout?
Seems like this would work:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layercontainer"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp">
<ImageView android:id="@+id/categoryIcon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<TextView android:id="@+id/categoryTitle"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:textStyle="bold"
android:textSize="22dp"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" />
<ImageView
android:id="@+id/nextIcon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="center_vertical"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"/>
</LinearLayout>
You should user LinearLayout for a simple xml structure
Because The LinearLayout is the most simple layout available in Android. A LinearLayout organizes layout components in a linear fashion horizontally or vertically
Creating Efficient Layouts says about performance of RelativeLayout and LinearLayout:
来源:https://stackoverflow.com/questions/10075475/android-relative-layout-cant-make-image-on-center