Дано:
Замечено:
Я пробовал и Relative, и LinearLayout (с верхним фрагментом, установленным на weight=1
), но оба не действуют после удаления нижнего фрагмента. У меня все еще есть пустое место внизу
Вот макет верхнего уровня файл:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dip" android:layout_weight="1"/>
<!-- This gets replaced with appropriate fragment at run time -->
<LinearLayout
android:id="@+id/scrollFragmentPlaceholder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="110dip" />
</LinearLayout>
Вот код, который переключает фрагмент
Fragment scroll = getSupportFragmentManager().findFragmentById(R.id.scrollFragment);
if (scroll.isHidden() == isWebView)
return; // already handled, do nothing
FragmentTransaction tr = getSupportFragmentManager().beginTransaction();
if (scroll != null && scroll.isAdded()) {
if (isWebView) {
tr.hide(scroll);
} else
tr.show(scroll);
}
tr.commit();
А вот как это выглядит: