Reputation: 5954
I would like to resize the tabhost in android. I know it is deprecated, but this has been wonderful option for me because I am using ListActivity with custom cursor Adaptor. I am not if this posible with Fragment Tabhost.
Anyways to resize the tab height:
I tried the following:
for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++)
{
tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 80;
}
It worked in few phones only. Is there any other way to solve this issue?
Thanks!
Upvotes: 1
Views: 4467
Reputation: 15358
Right now, you are setting it in pixels, you should use dp,
try to replace
tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 80;
with
tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = (int) (80 * this.getResources().getDisplayMetrics().density);
Upvotes: 6
Reputation: 362
Change the height of the tabwidget in the xml file.
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="30dp">
</TabWidget>
Change the height to whatever? That worked for me, if that is what you were looking for.
Upvotes: 0