I am creating custom ActionBar with two images and text. The first ImageView (icon) shall be fixed to the left, next to it the TextView, second ImageView (image) to be fixed to the right. The size of images and text must be the same on all screens. How can I do this?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="6">
<ImageView
android:id="@+id/icon"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:contentDescription="@null"
android:src="@drawable/ic_launcher"
android:layout_weight="1"/>
<LinearLayout
android:id="@+id/layout_text"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_toRightOf="@id/icon"
android:layout_gravity="center_vertical">
<TextView
android:id="@+id/actionbar_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="mAPP"
android:gravity="center_vertical"
android:textColor="#ffffff"
android:textSize="@dimen/actionbar_title_text_size" />
</LinearLayout>
<ImageView
android:id="@+id/image"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:layout_toRightOf="@id/layout_text"
android:contentDescription="@null"
android:src="@drawable/ic_image" />
</LinearLayout>