简体   繁体   English

关于LinearLayoutManager.scrollToPositionWithOffset(int,int)

[英]About LinearLayoutManager.scrollToPositionWithOffset(int,int)

When I invoke the function moveScrollViews(float) in the FragmentThree.enter(), the application will crash and the logcat has no exception. 当我在FragmentThree.enter()中调用函数moveScrollViews(float)时,应用程序将崩溃并且logcat没有异常。 But I found that the memory allocated to the application increased from 46MB to 95MB. 但我发现分配给应用程序的内存从46MB增加到95MB。 If I don't invoke the function, everything is okay. 如果我不调用该功能,一切都没问题。 The five RecyclerViews is in a fragment, and the fragment is a part of a ViewPager. 五个RecyclerViews位于片段中,片段是ViewPager的一部分。 My English is poor, but I'm studying it hard. 我的英语很差,但我正在努力学习。 Hope you understand my question. 希望你理解我的问题。 Thanks. 谢谢。 This is my Fragment 这是我的片段

public class FragmentThree extends BaseFragment{
private View root;
private RecyclerView recycler1;
private RecyclerView recycler2;
private RecyclerView recycler3;
private RecyclerView recycler4;
private RecyclerView recycler5;

private int scrollOffsetX;
private Point sharedElemScrollPoint;
private int finishHeight;
private int finishWidth;

public static FragmentThree newInstance(int position){
    FragmentThree scene = new FragmentThree();

    Bundle args = new Bundle();
    args.putInt(KEY_POSITION, position);
    scene.setArguments(args);

    return scene;
}
@Override
public int getLayoutId() {
    return R.layout.fragment_three;
}

@Override
public void init(View view) {
    root=view.findViewById(R.id.root);
    setRootPositionTag(root);
    if(root==view){
        Log.e("SAME","SAME");
    }

    recycler1=(RecyclerView) view.findViewById(R.id.recycler_1);
    recycler2=(RecyclerView) view.findViewById(R.id.recycler_2);
    recycler3=(RecyclerView) view.findViewById(R.id.recycler_3);
    recycler4=(RecyclerView) view.findViewById(R.id.recycler_4);
    recycler5=(RecyclerView) view.findViewById(R.id.recycler_5);
    setRecyclerView(recycler1,getResources().obtainTypedArray(R.array.images_1));
    setRecyclerView(recycler2,getResources().obtainTypedArray(R.array.images_2));
    setRecyclerView(recycler3,getResources().obtainTypedArray(R.array.images_3));
    setRecyclerView(recycler4,getResources().obtainTypedArray(R.array.images_4));
    setRecyclerView(recycler5,getResources().obtainTypedArray(R.array.images_5));
}

private void setRecyclerView(RecyclerView recyclerView, TypedArray drawables) {
    LinearLayoutManager layoutManager =
            new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);

    recyclerView.setLayoutManager(layoutManager);
    ImageAdapter adapter = new ImageAdapter(drawables);
    recyclerView.setAdapter(adapter);
}


@Override
public void enter(@Nullable ImageView shareElem, float position) {

    if(sharedElemScrollPoint==null){
        setTransition(shareElem);
    }
    root.setAlpha(1-position);
    shareElem.setX(sharedElemScrollPoint.x*(1-position));
    shareElem.setY(-getResources().getDimension(R.dimen.tutorial_shared_element_translate_y)
            + (sharedElemScrollPoint.y * (1 - position)));
    scaleShareImg(shareElem,position);
    setRoundImg(shareElem,position);
    moveScrollViews(position);
}

private void setTransition(ImageView shareElem){
    ImageView finishView=(ImageView)recycler2.getLayoutManager().findViewByPosition(0);
    finishView.setVisibility(View.INVISIBLE);

    finishWidth=finishView.getWidth();
    finishHeight=finishView.getHeight();

    Point finishLocation= ViewHelper.getViewLocation(finishView);
    // find the point of the screen(middle - half image) and for final point to be centered
    int screenCenterX = ViewHelper.getDisplaySize(getActivity()).x / 2;
    int finishWidth = finishView.getWidth() / 2;
    int finishX = screenCenterX - finishWidth;

    scrollOffsetX=finishX - finishLocation.x;

    Point sharedPoint=ViewHelper.getViewLocation(shareElem);
    sharedElemScrollPoint=new Point();
    sharedElemScrollPoint.x=finishX - sharedPoint.x;
    sharedElemScrollPoint.y=finishLocation.y - sharedPoint.y;
}

private void scaleShareImg(ImageView sharedElement,float position){
    float scaleX = 1 - ((float) finishWidth / sharedElement.getWidth());
    float scaleY = 1 - ((float) finishHeight / sharedElement.getHeight());

    // scale around the center
    sharedElement.setPivotX(1.0f);
    sharedElement.setPivotY(1.0f);

    // scale the shared image to the finish views size
    sharedElement.setScaleX((1 - (scaleX * (1 - position))));
    sharedElement.setScaleY((1 - (scaleY * (1 - position))));
}

@Override
public void center(@Nullable ImageView shareElem, float position) {
    root.setAlpha(1f);
    shareElem.setX(sharedElemScrollPoint.x);
    shareElem.setY(-getResources().getDimension(R.dimen.tutorial_shared_element_translate_y)
            + sharedElemScrollPoint.y);
    scaleShareImg(shareElem,0);
    setRoundImg(shareElem, 0);
    //moveScrollViews(0);
}

@Override
public void exit(@Nullable ImageView shareElem, float position) {
}

@Override
public void notInScene() {
    //moveScrollViews(1.0f);
    root.setAlpha(0f);
}


private void moveScrollViews(float position){
    int scroll = (int) (scrollOffsetX * (1 - position) + 200);
    scrollRecyclerViewTo(recycler1,-scroll);
    scrollRecyclerViewTo(recycler2,scroll);
    scrollRecyclerViewTo(recycler3,-scroll);
    scrollRecyclerViewTo(recycler4,scroll);
    scrollRecyclerViewTo(recycler5,-scroll);

}
private void scrollRecyclerViewTo(RecyclerView recycler,int offset){
    LinearLayoutManager linearLayoutManager=(LinearLayoutManager) recycler.getLayoutManager();
    linearLayoutManager.scrollToPositionWithOffset(2,offset);
    Log.e("Scroo","Scroll"+offset);

}
}

This is my ViewPager.PageTransformer 这是我的ViewPager.PageTransformer

public class IntroTransformer implements ViewPager.PageTransformer{
private List<TransformerListener> listeners=new ArrayList<>();
private ImageView shareElem=null;
@Override
public void transformPage(View page, float position) {
    page.setTranslationX(page.getWidth() * -position);

    int tag=(int)page.getTag();
    if(tag==0 && shareElem==null) {
        shareElem = (ImageView) page.findViewWithTag("shared_element");
    }
    makeCallback(listeners.get(tag),position);
}

private void makeCallback(TransformerListener listener,float position){
    if(enter(position)){
        listener.enter(shareElem,position);
    }else if(exit(position)){
        listener.exit(shareElem,position);
    }else if(center(position)){
        listener.center(shareElem,position);
    }else if(notInScene(position)){
        listener.notInScene();
    }
}
public void addPageTransformerListener(TransformerListener listener){
    listeners.add(listener);
}

public boolean enter(float position){return position>0f && position<1f;}
public boolean exit(float position){return position>-1f && position<0f;}
public boolean center(float position){return position==0f;}
public boolean notInScene(float position){return position<=-1f || position>=1f;}
}

Here is my logcat. 这是我的logcat。

    11-16 13:48:30.019 17293-17293/? I/art: Late-enabling -Xcheck:jni
    11-16 13:48:30.035 17293-17299/? E/art: Failed sending reply to debugger: Broken pipe
    11-16 13:48:30.035 17293-17299/? I/art: Debugger is no longer active
    11-16 13:48:30.072 17293-17293/? W/System: ClassLoader referenced unknown path: /data/app/com.jsnu.newpractice-2/lib/arm64
    11-16 13:48:30.074 17293-17293/? I/InstantRun: Instant Run Runtime started. Android package is com.jsnu.newpractice, real application class is com.jsnu.newpractice.MyApplication.
    11-16 13:48:30.241 17293-17293/? W/System: ClassLoader referenced unknown path: /data/app/com.jsnu.newpractice-2/lib/arm64
    11-16 13:48:30.337 17293-17293/? I/HwCust: Constructor found for class android.app.HwCustHwWallpaperManagerImpl
    11-16 13:48:30.380 17293-17293/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
    11-16 13:48:30.597 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.597 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=750, h=750, format=0x1, usage=0x2000003
    11-16 13:48:30.598 17293-17293/? I/gralloc: Alloc handle(0x7f85ca8b00): interfmt=0x1, stride=768, size=2310144
    11-16 13:48:30.608 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=2250, h=2250, format=0x1, usage=0x2000003
    11-16 13:48:30.615 17293-17293/? I/gralloc: Alloc handle(0x7f8c3a8800): interfmt=0x1, stride=2304, size=20754432
    11-16 13:48:30.650 17293-17293/? I/gralloc: Free handle(0x7f8c3a8800)
    11-16 13:48:30.650 17293-17293/? I/gralloc: Free handle(0x7f85ca8b00)
    11-16 13:48:30.657 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.657 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=750, h=750, format=0x1, usage=0x2000003
    11-16 13:48:30.658 17293-17293/? I/gralloc: Alloc handle(0x7f8c38af00): interfmt=0x1, stride=768, size=2310144
    11-16 13:48:30.668 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=2250, h=2250, format=0x1, usage=0x2000003
    11-16 13:48:30.674 17293-17293/? I/gralloc: Alloc handle(0x7f7367e000): interfmt=0x1, stride=2304, size=20754432
    11-16 13:48:30.709 17293-17293/? I/gralloc: Free handle(0x7f7367e000)
    11-16 13:48:30.709 17293-17293/? I/gralloc: Free handle(0x7f8c38af00)
    11-16 13:48:30.846 17293-17316/? I/OpenGLRenderer: Initialized EGL, version 1.4
    11-16 13:48:30.866 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.866 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:30.867 17293-17293/? I/gralloc: Alloc handle(0x7f735fe400): interfmt=0x1, stride=384, size=339968
    11-16 13:48:30.870 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:30.871 17293-17293/? I/gralloc: Alloc handle(0x7f735fe600): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:30.878 17293-17293/? I/gralloc: Free handle(0x7f735fe600)
    11-16 13:48:30.878 17293-17293/? I/gralloc: Free handle(0x7f735fe400)
    11-16 13:48:30.880 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.880 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:30.880 17293-17293/? I/gralloc: Alloc handle(0x7f735fe500): interfmt=0x1, stride=384, size=339968
    11-16 13:48:30.883 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:30.885 17293-17293/? I/gralloc: Alloc handle(0x7f735fe700): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:30.892 17293-17293/? I/gralloc: Free handle(0x7f735fe700)
    11-16 13:48:30.892 17293-17293/? I/gralloc: Free handle(0x7f735fe500)
    11-16 13:48:30.894 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.894 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:30.894 17293-17293/? I/gralloc: Alloc handle(0x7f735fe600): interfmt=0x1, stride=384, size=339968
    11-16 13:48:30.896 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:30.898 17293-17293/? I/gralloc: Alloc handle(0x7f735fe800): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:30.905 17293-17293/? I/gralloc: Free handle(0x7f735fe800)
    11-16 13:48:30.905 17293-17293/? I/gralloc: Free handle(0x7f735fe600)
    11-16 13:48:30.907 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.907 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:30.907 17293-17293/? I/gralloc: Alloc handle(0x7f735fe800): interfmt=0x1, stride=384, size=339968
    11-16 13:48:30.910 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:30.911 17293-17293/? I/gralloc: Alloc handle(0x7f735fea00): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:30.918 17293-17293/? I/gralloc: Free handle(0x7f735fea00)
    11-16 13:48:30.918 17293-17293/? I/gralloc: Free handle(0x7f735fe800)
    11-16 13:48:30.920 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.921 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:30.921 17293-17293/? I/gralloc: Alloc handle(0x7f735fea00): interfmt=0x1, stride=384, size=339968
    11-16 13:48:30.923 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:30.925 17293-17293/? I/gralloc: Alloc handle(0x7f735fec00): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:30.932 17293-17293/? I/gralloc: Free handle(0x7f735fec00)
    11-16 13:48:30.932 17293-17293/? I/gralloc: Free handle(0x7f735fea00)
    11-16 13:48:30.934 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.934 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:30.934 17293-17293/? I/gralloc: Alloc handle(0x7f735fec00): interfmt=0x1, stride=384, size=339968
    11-16 13:48:30.937 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:30.938 17293-17293/? I/gralloc: Alloc handle(0x7f735fee00): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:30.945 17293-17293/? I/gralloc: Free handle(0x7f735fee00)
    11-16 13:48:30.945 17293-17293/? I/gralloc: Free handle(0x7f735fec00)
    11-16 13:48:30.949 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.949 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:30.949 17293-17293/? I/gralloc: Alloc handle(0x7f85dff000): interfmt=0x1, stride=384, size=339968
    11-16 13:48:30.952 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:30.953 17293-17293/? I/gralloc: Alloc handle(0x7f85dff200): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:30.959 17293-17293/? I/gralloc: Free handle(0x7f85dff200)
    11-16 13:48:30.960 17293-17293/? I/gralloc: Free handle(0x7f85dff000)
    11-16 13:48:30.962 17293-17293/? I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:30.962 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:30.963 17293-17293/? I/gralloc: Alloc handle(0x7f85dff200): interfmt=0x1, stride=384, size=339968
    11-16 13:48:30.965 17293-17293/? I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:30.966 17293-17293/? I/gralloc: Alloc handle(0x7f85dff400): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:30.973 17293-17293/? I/gralloc: Free handle(0x7f85dff400)
    11-16 13:48:30.973 17293-17293/? I/gralloc: Free handle(0x7f85dff200)
    11-16 13:48:30.979 17293-17293/? W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatImageView{e9167dc V.ED..... ......ID 0,0-708,708 #7f0c005a app:id/sharedImage} during layout: running second layout pass
    11-16 13:48:35.626 17293-17293/com.jsnu.newpractice I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:35.626 17293-17293/com.jsnu.newpractice I/gralloc: Alloc         req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:35.626 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f7164da00): interfmt=0x1, stride=384, size=339968
    11-16 13:48:35.629 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:35.630 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f7164dc00): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:35.640 17293-17293/com.jsnu.newpractice I/gralloc: Free         handle(0x7f7164dc00)
    11-16 13:48:35.640 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f7164da00)
    11-16 13:48:35.652 17293-17293/com.jsnu.newpractice I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:35.652 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=750, h=750, format=0x1, usage=0x2000003
    11-16 13:48:35.653 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f7164dc00): interfmt=0x1, stride=768, size=2310144
    11-16 13:48:35.667 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=2250, h=2250, format=0x1, usage=0x2000003
    11-16 13:48:35.675 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f7164de00): interfmt=0x1, stride=2304, size=20754432
    11-16 13:48:35.721 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f7164de00)
    11-16 13:48:35.721 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f7164dc00)
    11-16 13:48:35.723 17293-17293/com.jsnu.newpractice I/BitmapFactory:         set decoder allocator to gralloc
    11-16 13:48:35.723 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:35.724 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f7164dd00): interfmt=0x1, stride=384, size=339968
    11-16 13:48:35.726 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:35.727 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f7164df00): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:35.734 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f7164df00)
    11-16 13:48:35.734 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f7164dd00)
    11-16 13:48:35.737 17293-17293/com.jsnu.newpractice I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:35.737 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:35.737 17293-17293/com.jsnu.newpractice I/gralloc: Alloc         handle(0x7f7164df00): interfmt=0x1, stride=384, size=339968
    11-16 13:48:35.744 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:35.745 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f709a4100): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:35.752 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f709a4100)
    11-16 13:48:35.753 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f7164df00)
    11-16 13:48:35.754 17293-17293/com.jsnu.newpractice I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:35.754 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:35.755 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f709a4000): interfmt=0x1, stride=384, size=339968
    11-16 13:48:35.758 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:35.759 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f709a4200): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:35.766 17293-17293/com.jsnu.newpractice I/gralloc: Free         handle(0x7f709a4200)
    11-16 13:48:35.766 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f709a4000)
    11-16 13:48:35.768 17293-17293/com.jsnu.newpractice I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:35.769 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:35.769 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f709a4100): interfmt=0x1, stride=384, size=339968
    11-16 13:48:35.771 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:35.772 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f709a4300): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:35.778 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f709a4300)
    11-16 13:48:35.779 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f709a4100)
    11-16 13:48:35.783 17293-17293/com.jsnu.newpractice I/BitmapFactory: set decoder allocator to gralloc
    11-16 13:48:35.783 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=330, h=220, format=0x1, usage=0x2000003
    11-16 13:48:35.783 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f709a4400): interfmt=0x1, stride=384, size=339968
    11-16 13:48:35.785 17293-17293/com.jsnu.newpractice I/gralloc: Alloc req: dev=0x7f8c1cb880, w=990, h=660, format=0x1, usage=0x2000003
    11-16 13:48:35.786 17293-17293/com.jsnu.newpractice I/gralloc: Alloc handle(0x7f709a4600): interfmt=0x1, stride=1024, size=2703360
    11-16 13:48:35.793 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f709a4600)
    11-16 13:48:35.793 17293-17293/com.jsnu.newpractice I/gralloc: Free handle(0x7f709a4400)
    11-16 13:48:35.801 17293-17303/com.jsnu.newpractice I/art: GC statistics: 19 time(s), freed 22206(22MB) objects, paused 6.407ms total 151.611ms

Try to add 尝试添加

android:largeHeap="true"

into your Manifest application tag 进入你的Manifest应用程序标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM