ImageView not showing

I have two elements ImageViewin FrameLayout: imageView1 and imageView2. imageView1 is displayed, and imageView2 is placed off the screen when the activity starts. Then I rotate FrameLayoutin some custom event using RotateAnimation, so the image of View2 should become visible and the image of View1 should exit the screen. But imageView2 is still invisible. Does anyone know what is the reason?

Too big and complicated code. But since I figured out the main problem when translating and rotating images using the setImageMatrix function and the special behavior FrameLayoutor ImageViewthat crop the image if it goes beyond.

0
source share
2 answers

If I understand your situation correctly, then you are mistaken. FrameLayout pushes it on the stack, not side by side. Thus, they are not displayed off-screen, imageView2 is located right behind imageView1. And to show this, you must bring it to the fore.

I would suggest you look at the ViewSwitcher / ViewAnimator layouts. I think they will suit your needs.

+2
source

I solved my problem. I just changed the height in LayoutParamsof FrameLayoutfrom "fill_parent" to the exact height, which allows me to save everything ImageViewin FrameLayout.

0
source

All Articles