android - TabWidget doesn't fill in HorizontalScrollView -
i want show tabs width horizontal scrollbar. tried implement how set tab view scroll?
but tabs doesn't fill width.
how fix it?
<?xml version="1.0" encoding="utf-8"?> <tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <horizontalscrollview android:id="@+id/horizontalscrollview1" android:layout_width="fill_parent" android:layout_height="wrap_content" > <linearlayout android:layout_width="fill_parent" android:layout_height="match_parent" android:orientation="horizontal" > <tabwidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" > </tabwidget> </linearlayout> </horizontalscrollview> <framelayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"> </framelayout> </linearlayout> <progressbar android:id="@+id/destinationprogressbar" style="?android:attr/progressbarstylelarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> </tabhost> 
solved it! use android:fillviewport="true" , remove linearlayout.
<?xml version="1.0" encoding="utf-8"?> <tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <horizontalscrollview android:id="@+id/horizontalscrollview1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillviewport="true"> <tabwidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" > </tabwidget> </horizontalscrollview> <framelayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"> </framelayout> </linearlayout> <progressbar android:id="@+id/destinationprogressbar" style="?android:attr/progressbarstylelarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> </tabhost>
Comments
Post a Comment