问题
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