I have placed ImageView
, fragment tabhost and an ImageButton
on a bar I created, I want the content of the tabhost to occupy the full width however all I am getting is as shown in the image. I searched high and low but couldn't find a solution!
The XML code is as below
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#2D5990"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.105"
android:src="@drawable/ic_launcher"
android:layout_marginLeft="2dp"
android:paddingTop="5dp"
android:paddingBottom="5dp" />
<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:contentDescription="No Desc"
android:padding="3dp"
android:gravity="right"
android:layout_weight="0.2"
android:src="@drawable/ic_launcher" />
</LinearLayout>
Sorry I have updated the code now
The content of the fragment tabhost wont occupy full width if you are using ImageView
and ImageButton
inside your layout.
You have to use only android.support.v4.app.FragmentTabHost
, if you want your fragment tabhost to occupy full width of your layout.
So, try removing ImageView
and ImageButton
from your layout.
I hope this might help you.