Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.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上实现平滑过渡效果_Android_Animation_Fragment - Fatal编程技术网

如何在android上实现平滑过渡效果

如何在android上实现平滑过渡效果,android,animation,fragment,Android,Animation,Fragment,我使用setCustomAnimations 方法。我有三个片段,其中两个只包含背景图像,一个片段包含三个画廊视图 现在,在这些片段上应用过渡效果时。包含图库视图的片段相对于剩余片段缓慢应用过渡效果 如何才能解决这个问题,必须感觉到三个碎片具有相同的平滑度。 查看我的代码如何将转换应用于片段 FragmentTransaction previewTransition=fragmentManager.beginTransaction(); previewTransition.setCustomAn

我使用
setCustomAnimations

方法。我有三个片段,其中两个只包含背景图像,一个片段包含三个画廊视图

现在,在这些片段上应用过渡效果时。包含图库视图的片段相对于剩余片段缓慢应用过渡效果

如何才能解决这个问题,必须感觉到三个碎片具有相同的平滑度。 查看我的代码如何将转换应用于片段

FragmentTransaction previewTransition=fragmentManager.beginTransaction();
previewTransition.setCustomAnimations(R.anim.leftin,R.anim.leftout);
PreviewFragment preview=new PreviewFragment();
previewTransition.replace(R.id.fragcontainer,preview,"Preview");
previewTransition.commit();
这是适配器getView()方法代码

@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view;
        if(imagePaths.size() == 0)
        {
            return getCustomView();
        }
        int itemPos;
        try {
            itemPos = (position % imagePaths.size());
            if(images[itemPos] == null){
                String path = imagePaths.get(itemPos);
                BitmapDrawable drawable =new BitmapDrawable(BitmapFactory.decodeFile(path));
                drawable.setAntiAlias(true);
                images[itemPos] = drawable;
            }
        } catch (OutOfMemoryError e) {
            return getCustomView();
        }
        view=convertView;
        if(view==null)
        view = getCustomView();
        ImageView containerImage=(ImageView)view.findViewById(R.id.container);
        containerImage.setImageDrawable(images[itemPos]);
        return view;
    }
    private View getCustomView()
    {
        View imgLayout=(RelativeLayout)inflaterLayout.inflate(R.layout.conainers,null);
        return imgLayout;
    }

谢谢你

我对这个问题不太清楚。过渡动画是否不平滑,或者库片段的平滑度是否存在问题?库片段存在问题,仅剩下两个片段是平滑的,因为仅库视图平滑度降低,但这是从库片段过渡到下一个片段,还是仅是库片段的平滑度碎片是一个问题?它是从frament1到grallery碎片的转换