title: Animate fragments content before closing it
body: <p>I am displaying a <code>FrameLayout</code> with some components inside a <code>Fragment</code>. In <code>onCreateView(..)</code> I am animating the content of the <code>FrameLayout</code> and everything works fine. Now I want to animate the content before closing the <code>Fragment</code>. </p>
  
  <p>In my current solution I am overriding <code>onBackPressed()</code> in the parent <code>Activity</code> and then I'm calling the method <code>onBackPressed()</code> inside my <code>Fragment</code> and animating the content there. The problem with this solution is, that I want to inflate the <code>Fragment</code> from various activities and then this is not really a nice solution... Does anybody know a better approach?</p>
  
  <p>Thanks for your help!</p>
  
  <p><strong>Note:</strong> </p>
  
  <p>I also tried to override <code>onCreateView()</code> and <code>onPause()</code> but the animation is not shown if I start it in those methods</p>
  
  <p>and the following method does not fulfill my requirements either as it animates the whole fragment and I want to animate the content</p>
  
  <pre><code>getActivity().getSupportFragmentManager()
              .beginTransaction()
              .setCustomAnimations(R.anim.slide_in_up, R.anim.slide_out_up, R.anim.slide_out_down, R.anim.slide_in_down)
  </code></pre>