我最近得到了一些淡入淡出的东西,所以我的“加载”视图是一个ImageView,它占据了整个屏幕,然后在主视图(在这种情况下是一个GridView)淡入其顶部。在活动中创造的,我称之为:Android:在使用Window.addContentView时清除隐藏视图?
setContentView(R.layout.loading_foo);
那么当装载的AsyncTask完成后,我拨打以下:
LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
GridView gridview = (GridView) inflater.inflate(R.layout.foo, null);
//fade in the view as it's shown
gridview.setAnimation(AnimationUtils.loadAnimation(this, R.anim.fade_in));
//populate the items adapter
gridview.setAdapter(new FooGridAdapter(apps));
//now overlay the gridview on top of the loading_springboard page
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
getWindow().addContentView(gridview, layoutParams);
我需要做什么特别清理loading_foo视图减少我的应用程序使用的内存量?这种方法的其他问题?
(很长一段时间的读者,首次海报)
2009-11-19
Eric