码迷,mamicode.com
首页 > 其他好文 > 详细

ViewHolder优化2>:

时间:2016-04-05 12:29:49      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:

ViewHoder优化:   
 @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder viewHolder = null;
            if (convertView == null) {
                convertView = View.inflate(getActivity(), R.layout.lv_item,
                        null);
                viewHolder = new ViewHolder();
                convertView.setTag(viewHolder);
                viewHolder.lv_imageView = (ImageView) convertView
                        .findViewById(R.id.lv_imageView);
                viewHolder.lv_textView = (TextView) convertView
                        .findViewById(R.id.lv_textView);
            } else {
                viewHolder = (ViewHolder) convertView.getTag();
            }
 
            viewHolder.lv_textView.setText(list.get(position).title);
    class ViewHolder {
            ImageView lv_imageView;
            TextView lv_textView;
        }

ViewHolder优化2>:

标签:

原文地址:http://www.cnblogs.com/welldones/p/5354243.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!