In my app I use the following FrameLayout as a container for a fragment that will be a footer:
<FrameLayout
android:id="@+id/frameLayoutFooter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"/>
In my activity I use the following code in order to add the fragment:
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
mFooterFragment = new FooterFragment();
ft.add(R.id.frameLayoutFooter, mFooterFragment);
ft.commit();
And the layout of my footer fragment is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/footerContainer"
android:layout_width="fill_parent"
android:layout_height="165dip"
android:layout_alignParentBottom="true"
android:background="#15355b" >
<RelativeLayout
android:id="@+id/relativeLayoutTopSetcion"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
..... some buttons and imageviews here...
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayoutBottomSetcion"
android:layout_width="fill_parent"
android:layout_height="350dip"
android:layout_alignParentBottom="true"
android:visibility="**invisible**" >
..... some more imageviews and textviews here...
</RelativeLayout>
</RelativeLayout>
At some point I would like to expand the footer and put some more imageviews and textviews in it, but unfortunately all my tries have failed, the result is that the fragment's FrameLayout does get expanded but its children stays in the upper (old bottom) part even although they have alignParentBottom set to true - what i get is that the footer's height does change and its bottom newly added part is transparent, which makes me think that the its children are not updated with its new layout params. Another thing is that I do see the the change of the mRelativeLayoutBottomSetcion.setVisibility(View.VISIBLE) -but is not in the bottom (the newly expanded section) of the FrameLayout but in the bottom of the original size before expanding.
in order to expand the fragment I used the following code from the activity this framents belongs to:
ViewGroup.LayoutParams params = mFrameLayoutFooter.getLayoutParams();
params.height = 500;
mFrameLayoutFooter.requestLayout();
// setting the bootom relative layout to be visible
mRelativeLayoutBottomSetcion.setVisibility(View.VISIBLE);
What am I doing wrong ?
Is there a known UI pattern for expendable footer ?
Thanks in advance