Android spacing two fragments on same screen -
i have activity displays 2 fragments on screen, 1 under other. top fragment user interface activity , second custom listview. have 2 fragments can fill top slot, each different size. listview used both.
the problem i'm facing there major gap between top , bottom fragments. know has layout_weight attribute, , layout_weight way i've seen control how of screen fragment commands.
what find out if there way dynamically resize reserved fragment area when fragment loaded, or if i'm stuck ugly gap.
here layout:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <tabhost 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" > <tabwidget android:id="@android:id/tabs" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0" /> <framelayout android:id="@android:id/tabcontent" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="0"/> <framelayout android:id="@+android:id/realtabcontent1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"/> <framelayout android:id="@+android:id/realtabcontent2" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="2" /> </linearlayout> </tabhost> </linearlayout>
i have figured out. layout height of both framelayouts hosting fragments should set android:layout_height="wrap_content"
, layout_weight
line should removed. spacing handled dynamically on fragment being loaded framelayout.