ImageView is not visible

有些话、适合烂在心里 提交于 2019-12-12 03:57:02

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/12515036/imageview-is-not-visible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!