I have a fullscreen view flipper on the galaxy tab containing two relative layouts, each of which is displaying between five and ten image views.
I am having problems when I try to slide one of the view flipper viewso ut and the other in, the "animation" does nothing and then just switches.
If I remove all but one of the image views in each of the view flipper children the animation is fine.
Can I somehow force it to use a mixed down version of the image for the animation, or is the relative layout container causing the performance problem?
There should be nothing going on at the time the flipper animation occurs so I can't understand the problem.
Thanks
EDIT: Some of the problematic code: Perhaps this might indicate areas causing the performance problems?
I have in my onClick, two method calls, used for switching backwards through the views and forward. A view is "generated" immediately before being added to the flipper and switched.
so, on the click of the back button (for example) I have (amongst other things) ....
nextView = new RelativeLayout(this);
makeAView(selectedViewObjects, viewHolder2);
switchViewNow(-1);
currentView = nextView;
...
private void makeAView(ViewObjects vObjects, RelativeLayout nextView)
{
for(Object obj : vObjects.viewObjects)
{
if(obj instanceof Image)
{
addImageView(nextView, obj);
{
else
{
if(obj instanceof Anim)
{
addAnimView(nextView, obj);
}
}
Where Image is a custom View implementation for displaying a static image and Anim is a custom view implementation for displaying an AnimationDrawable (multiframe image cycle).
Next we have the switch method:
private void switchViewNow(int direction)
{
if(direction == -1)
{
viewFrame.setInAnimation(AnimClass.inFromLeftAnimation(null));
viewFrame.setOutAnimation(AnimClass.outToRightAnimation(null));
viewFrame.showNext();
}
else
if(direction == 1)
{
viewFrame.setInAnima开发者_开发百科tion(AnimClass.inFromRightAnimation(null));
viewFrame.setOutAnimation(AnimClass.outToLeftAnimation(null));
viewFrame.showNext();
}
}
I could be wrong, but it looks to me like you have overloaded nextView in a confusing way.
It is defined outside of makeAView, but makeAView expects a parameter which it names nextView.
You are passing viewHolder2 as nextView to this function.
This means that makeAView will NOT change the 'global' nextView, it will change viewHolder2.
But then you seem to assume that the 'global' nextView has been modified because you use it to assign currentView.
I think it would be a good place to start if you assign unique names to these two versions of nextView.
I wonder if you are even still looking for a solution: this post is rather old and ignored.
精彩评论