4

I have a Parent FragmentActivity with a main view where I do FragmentTransactions and periodically switch views. But one particular view (a Fragment) is animated and slide in from right side of screen. I would like the view to be above (or on top of) the ActionBar.

The best example is taken from the app WunderList. Here is a screenshot.

enter image description here

Their app ALSO slides in and animates and this is exact functionality I am trying to duplicate. Can you do this with a Fragment? Or is this probably a new Activity?

TheLettuceMaster
  • 14,856
  • 42
  • 142
  • 248
  • 1
    Maybe you can try DialogFragment with custom animation: http://stackoverflow.com/questions/13402782/show-dialogfragment-with-animation-growing-from-a-point – Michal Kubenka Mar 24 '13 at 15:30

3 Answers3

2

You can't put fragment over ActionBar, but you can play with hide/show ActionBar.

On your new Fragment (on method onCrate) call:

your_activity.getSupportActionBar().setShowHideAnimationEnabled(false);
your_activity.getSupportActionBar().hide();

Then, when you want to came back to your previous screen, show ActionBar, call on method onPause:

your_activity.getSupportActionBar().setShowHideAnimationEnabled(false);
your_activity.getSupportActionBar().show();
1

You can do it the way you want (with or without Fragments). As answered in the other post, we've released a library that makes the sliding layer work for you (just drop it in your xml as a normal container and put whatever you need inside).

That said, the remaining issue is more related to the ActionBar being at the top or bottom layer and that has more to do with the place that it takes in your app. In the end you'll have to play around with the indices of your views and the ActionBar within their container.

For instance we did our own ActionBar which made it easier to play around and decide who goes on top and underneath, but as said it shouldn't be too much of a big deal even with the native one or Sherlock ones.

Can you post a picture of what you want to achieve?

Jose L Ugia
  • 5,572
  • 3
  • 21
  • 26
-1

I was able to Achieve the above effect using Fragments. Use :

fragmentTransaction.add(android.R.id.content, fragment_instance);

where android.R.id.content is always the root element of a View since api level 1 .