开发者

BaseAdapter view goes into blackhole, why?

开发者 https://www.devze.com 2023-03-18 21:47 出处:网络
The first time getView is called, all is fine. The secon time, vi.getTag() returns null. why is this happening??

The first time getView is called, all is fine. The secon time, vi.getTag() returns null. why is this happening??

   @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View vi=convertView;
      ViewHolder holder;
      if( convertView == null ){
        vi = inflater.inflate(R.layout.comment_item, null);
        ho开发者_Python百科lder=new ViewHolder();
        holder.userName = (TextView) vi.findViewById(R.id.comment_username);
        holder.comment = (TextView) vi.findViewById(R.id.comment_comment);
        holder.img = (RoundedImageView) vi.findViewById(R.id.comment_img);
      } else {
        holder=(ViewHolder)vi.getTag();
      }


You are missing the vi.setTag(holder);.

0

精彩评论

暂无评论...
验证码 换一张
取 消