0

I have an ImageView inside an activity and when the user clicks on it, I animate the view height so it becomes fullscreen (other views are just become hidden below the bottom of the screen).

However once the animation is finished I hide the actionbar (using getSupportActionBar().hide()) so I then need to resize my ImageView just a little bigger again to take the full screen again.
In the parent View I tried overriding both onMeasure and onLayout to get the size available while the actionbar slides off the screen, but it does not work, I only get the new size at the end of the actionbar animation + when I set the height of the view and request layout it does not layout again (so I can still see the other views at the bottom of the screen).

qwertzguy
  • 15,699
  • 9
  • 63
  • 66

1 Answers1

3

Make the ActionBar an overlay by calling requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY) before calling setContentView() in your activity. Then when you run your animation, the full-screen size of the ImageView will go behind the ActionBar.

You might have to mess with the timing of when to hide the ActionBar if you don't want the ImageView to be seen behind it at all before you hide, but that can be done relatively easily with a Thread or AsyncTask.

Wenger
  • 989
  • 2
  • 12
  • 35
  • Thank you for your answer. The problem is I don't want the ActionBar to be in overlay mode. – qwertzguy Jun 19 '13 at 19:15
  • Or is it possible to make the ActionBar switch from non-overlay to overlay mode programatically while the activity is already launched? – qwertzguy Jun 19 '13 at 19:41
  • Not that I know of. You have to set the feature before calling `setContentView`. – Wenger Jun 20 '13 at 04:54