Android布局中的位图导致内存泄漏

Android布局中的位图导致内存泄漏,android,memory-leaks,bitmap,garbage-collection,Android,Memory Leaks,Bitmap,Garbage Collection,我试图弄明白为什么我的应用程序的位图只在xml布局中使用,永远不会被回收,所以当用户浏览10/12页后,应用程序会崩溃,并出现outofmemoryexception 我尝试使用Mat分析内存使用情况,我可以在保留的堆中找到每个位图 以下是如何在XML版面中使用图像(每个版面约1个): <ImageView android:id="@+id/imageView" android:layout_width="fill_parent" android:layout_height="2000dp

我试图弄明白为什么我的应用程序的位图只在xml布局中使用,永远不会被回收,所以当用户浏览10/12页后,应用程序会崩溃,并出现outofmemoryexception

我尝试使用Mat分析内存使用情况,我可以在保留的堆中找到每个位图

以下是如何在XML版面中使用图像(每个版面约1个):

<ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="2000dp"
android:scaleType="fitStart"
android:src="@drawable/welcome"/>
有什么想法吗?

使用图像加载器


这与在XML布局中使用图像的需要有什么关系?当我必须在我的应用程序中手动加载图像时,我会使用图像加载器之类的东西,而不是当静态图像用作背景时。imageLoader.DisplayImageUri,imageView;
 public void onCreate(Bundle savedInstanceState)
 {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.splash);

     ImageView but = (ImageView)findViewById(R.id.imageView2);

        View.OnClickListener listener = new View.OnClickListener() 
        {
            public void onClick(View view) 
            { 
                        Intent myIntent = new Intent(view.getContext(), EtaActivity.class);
                startActivity(myIntent);
                overridePendingTransition(0,0);    
                finish();
            }
        };

        but.setOnClickListener(listener); 
 }

public void onDestroy()
{
    super.onDestroy();
}