I have a listView, the list_item has a ImageButton at left, a TextView centered and a ImageButton at right:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<ImageButton android:id="@+id/parkingState"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_marginRight="4dip"
android:layout_marginLeft="4dip"
android:layout_gravity="center"
android:background="@null"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center">
<TextView android:id="@+id/LblSubTitle"
android:gravity="center_horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="normal"
android:textColor="#444444"
android:textSize="12sp" />
</LinearLayout>
<ImageButton android:id="@+id/parking_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginRight="4dip"
android:layout_marginLeft="4dip"
android:layout_marginTop="4dip"
android:layout_marginBottom="4dip"
android:background="@null"/>
</LinearLayout>
</LinearLayout>
The result is:

But I would like the images at left and a right. How can I get this effect?
use
RelativeLayoutinstead ofLinearLayout, and then you can use thelayouttags :android:layout_alignParentLeft = "true"andandroid:layout_alignParentRight = "true"NOTE : to center the
TextViewuse :android:layout_centerHorizontal="true"