I have created a set of vertical tabs using buttons to represent the tabs and I have set the height of the buttons to wrap content.
This doesnt seem to be respected though as the buttons scale to take up all available space, there are only 5 buttons in the vertical linear layout yet they all stretch to take up the available space. The icon in the button is small and so is the text so this doesnt look very good.
How do I get the buttons to truly only wrap their content? I would like them all the same size and to not fill all available space.
Is setting the height explicitly in dp a good or bad idea?
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.app.FragmentTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_grey">
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="8dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="8dp">
<FrameLayout android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="3">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/tab_btn_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1.0"
android:background="@color/lightest_grey"
android:id="@+id/patient_tab_btn"
android:text="Patient"
android:textSize="7sp"
android:gravity="bottom|center"
android:drawableTop="@drawable/user"
android:paddingTop="4dp"
/>
<Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1.0"
android:background="@color/lightest_grey"
android:id="@+id/relations_tab_btn"
android:text="Relations"
android:layout_marginTop="1dp"
android:textSize="7sp"
android:gravity="bottom|center"
android:drawableTop="@drawable/family"
android:paddingTop="4dp"
/>
<Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1.0"
android:background="@color/lightest_grey"
android:id="@+id/providers_tab_btn"
android:text="Providers"
android:layout_marginTop="1dp"
android:textSize="7sp"
android:gravity="bottom|center"
android:drawableTop="@drawable/doctors_bag"
android:paddingTop="4dp"
/>
<Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1.0"
android:background="@color/lightest_grey"
android:id="@+id/locations_tab_btn"
android:text="Locations"
android:layout_marginTop="1dp"
android:textSize="7sp"
android:gravity="bottom|center"
android:drawableTop="@drawable/map_marker"
android:paddingTop="4dp"
/>
<Button
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="1.0"
android:background="@color/lightest_grey"
android:id="@+id/summary_tab_btn"
android:text="Summary"
android:layout_marginTop="1dp"
android:textSize="7sp"
android:gravity="bottom|center"
android:drawableTop="@drawable/treatment_plan"
android:paddingTop="4dp"
/>
<Button
android:layout_height="|"
android:layout_width="match_parent"
android:layout_weight="1.0"
android:background="@color/lightest_grey"
android:id="@+id/cpis_tab_btn"
android:text="Protection"
android:layout_marginTop="1dp"
android:textSize="7sp"
android:gravity="bottom|center"
android:drawableTop="@drawable/students"
android:paddingTop="4dp"
/>
</LinearLayout>
</FrameLayout>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="17"
android:background="@color/white"/>
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
Thanks