I have an layout
Use RelativeLayout as a parent layout.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/groupname"
android:paddingLeft="50px"
android:textSize="16px"
android:textColor="#000000"
android:textStyle="normal"
android:layout_width="wrap_content"
android:layout_height="50px"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="6dp"
android:src="@drawable/ncc"/>
</RelativeLayout>
You can use drawableRight attribut to take it very simple like this example:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="50px"
android:textSize="16sp"
android:textStyle="normal"
android:drawableRight="@drawable/ic_favorite_gray"/>