0

I have 3 fragments on my activity and i want to hide one of them on the click of a button.... now that's easy using the FrameTransaction to hide it following this answer in Show hide fragment in android using this code

FragmentManager fm = getFragmentManager();
        fm.beginTransaction()
          .setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out)
          .show(somefrag)
          .commit();

... but my question here is how to extend one of the left fragments to expand and fill its place so i don't have an empty area and instead fill the screen..???

Here is my Activity layout having the 3 containers

<FrameLayout 
    android:id="@+id/container1"
    android:layout_width="match_parent"
    android:layout_height="50dip" />

<FrameLayout 
    android:id="@+id/container2"
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:background="#FFFF42" />

<FrameLayout 
    android:id="@+id/container3"
    android:layout_width="match_parent"
    android:layout_height="30dip" />

Community
  • 1
  • 1
SoliQuiD
  • 2,093
  • 1
  • 25
  • 29

1 Answers1

1

Try changing the visibility of its container:

FrameLayout container = (FrameLayout)findViewById(R.id.container3);
container.setVisibility(View.GONE);
ILovemyPoncho
  • 2,762
  • 2
  • 24
  • 37
  • ewww... yeah that helped.... i was trying to hide the fragment and forgot about hiding the container reserving space for it..thanks pal @ilovemyponcho – SoliQuiD Jun 23 '14 at 13:29