Pavlo Viazovskyy
Pavlo Viazovskyy

Reputation: 937

ImageView is not visible

I have two ImageView items in FrameLayout: imageView1 and imageView2. imageView1 is visible and imageView2 is positioned out of screen when activity starts. Then I rotate FrameLayout on some user event using RotateAnimation so imageView2 should become visible and imageView1 should go out of screen. But imageView2 still remains invisible. Does anyone know what's the reason?

The code is too large and complicated to show here. But as I have figured out the main problem in translating and rotating images using setImageMatrix function and special behavior of FrameLayout or ImageView, which crop image if it is out of their bounds.

Upvotes: 0

Views: 710

Answers (2)

Pavlo Viazovskyy
Pavlo Viazovskyy

Reputation: 937

I've solved my problem. I've just change height in LayoutParams of FrameLayout from "fill_parent" to exact height, which allows to keep all ImageView's in FrameLayout.

Upvotes: 0

Alex Orlov
Alex Orlov

Reputation: 18107

If I understood correctly your situation, then you are mistaken. FrameLayout places it's children in stack, not side by side. So they aren't rendered out of screen, imageView2 is right behind imageView1. And to show it, you should bring it to front.

I would suggest you to look at ViewSwitcher/ViewAnimator layouts. I think they'll suit your needs.

Upvotes: 2

Related Questions