I want to create some kind of toolBar in my app. On the left I'm displaying a fixed size imageView, on the right another one and in the middle I want to display a text, but it need to be truncated in case there isn't enought space... and that's where I'm failing
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/actionBar"
android:layout_width="match_parent"
android:layout_height="32dp"
android:background="@android:drawable/title_bar"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="left|center_vertical"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/actionBarIcon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="7dp"
android:adjustViewBounds="true"
android:background="@drawable/podcast_addict"
android:gravity="center_vertical"
android:onClick="onHome" >
</ImageButton>
<TextView
android:id="@+id/actionBarTitle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:singleLine="true"
android:text="@string/app_name"
android:textColor="#FFFFFF"
android:textSize="15sp"
android:textStyle="bold" >
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_weight="2"
android:gravity="right|center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="1px"
android:layout_height="match_parent"
android:layout_marginBottom="3dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="3dp"
android:background="@android:drawable/status_bar_item_app_background" />
<ImageView
android:id="@+id/actionButton"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:adjustViewBounds="true"
android:background="@android:drawable/stat_notify_sync_noanim"
android:gravity="center_vertical"
android:onClick="onAction" >
</ImageView>
<ImageView
android:layout_width="1px"
android:layout_height="match_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:background="@android:drawable/status_bar_item_app_background" />
<ImageButton
android:id="@+id/showHideButton"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:adjustViewBounds="true"
android:background="@android:drawable/ic_menu_view"
android:gravity="center_vertical"
android:onClick="onShowHide" >
</ImageButton>
<ImageView
android:layout_width="1px"
android:layout_height="match_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:background="@android:drawable/status_bar_item_app_background" />
<ImageButton
android:id="@+id/markReadButton"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:adjustViewBounds="true"
android:background="@android:drawable/checkbox_on_background"
android:gravity="center_vertical"
android:onClick="onMarkRead" >
</ImageButton>
</LinearLayout>
</LinearLayout>
when the text is short it seems to work, but when it's too long the 1st imageView on the right is hidden behind the text... How can I fix this ?