@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub Holder view = null; if (convertView == null) { view = new Holder(); convertView = inflater.inflate(R.layout.lv_item, null); view.imageView = (ImageView) convertView .findViewById(R.id.lv_icon); view.tv_appname = (TextView) convertView .findViewById(R.id.lv_item_appname); view.tv_package = (TextView) convertView .findViewById(R.id.lv_item_packagename); convertView.setTag(view);//通过setTag把该view保存起来。 } else { view = (Holder) convertView.getTag(); //convertView不为空是,直接拿到保存的view } view.imageView.setBackgroundResource(R.drawable.icon); view.tv_appname.setText("应用的名称"); view.tv_package.setText(context.getResources().getString(R.string.packageName)); return convertView; }
Android 软件管理器的开发
内容版权声明:除非注明,否则皆为本站原创文章。