Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 带有缩放动画的ListView不是';t平滑_Android_Android Listview_Android Animation - Fatal编程技术网

Android 带有缩放动画的ListView不是';t平滑

Android 带有缩放动画的ListView不是';t平滑,android,android-listview,android-animation,Android,Android Listview,Android Animation,当列表只有一行,只有一个文本视图时,它会被平滑地设置动画,当列表开始变重时,问题就开始了。当我加载更多行时,每一行都包含一个ImageView 我使用了我自己的动画,尽管我尝试了使用XML的更简单的方法,但效果并没有更好 这是动画: public Animation slidePaneAnim2 (final Context context, final View view, final int maxHeight, final boole

当列表只有一行,只有一个文本视图时,它会被平滑地设置动画,当列表开始变重时,问题就开始了。当我加载更多行时,每一行都包含一个ImageView

我使用了我自己的动画,尽管我尝试了使用XML的更简单的方法,但效果并没有更好

这是动画:

    public Animation slidePaneAnim2 (final Context context,
        final View view,
        final int maxHeight,
        final boolean openORclose ){

    /** Create new Slide Pane animation */
    Animation anim = new Animation() {
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            int newHeight;
            int initHeight=200;

            if (openORclose) {
                //In case we want to open pane
                newHeight = initHeight + (int) (maxHeight * interpolatedTime);
            } else {
                //In case we want to close pane
                newHeight = initHeight + (int) (maxHeight * (1-interpolatedTime));
            }
            //Apply new params
            view.getLayoutParams().height = newHeight;
            view.requestLayout();
        }
        ...
    };
  return anim;
}

有人知道如何使其更平滑吗?

问题在于您的
动画
,您正在
applyTransform
中调用
requestLayout
,这对性能非常不利。使用NineoldRoid动画库,您将看到不同之处。它类似于内置的新动画框架,但也支持较旧的Android版本。谢谢M-WaJeEh,这是一个很棒的图书馆,像魔术一样工作!