Giter Club home page Giter Club logo

Comments (3)

yilylong avatar yilylong commented on June 13, 2024

第一次item还没有生成吧 高亮的view是null的 具体查下你的逻辑吧

from highlight-guideview.

qianggithub avatar qianggithub commented on June 13, 2024

你好,我调试了一下发现第一次请求网络并给listview设置adapter,我发现convertView不是空的,但是就是不显示,能帮忙看下问题所在么?
`

                DockingScanEntity entity = JsonUtils.fromJsonToObj(success.getMsg(), DockingScanEntity.class);
                if (entity != null) {
                    for (int i = 0; i < list.size(); i++) {
                        if (list.get(i).getBarcode().equals(entity.getBarcode())) {
                            toast("已扫描过该条码");
                            return;
                        }
                    }

                    if (entity.getStyle().equals("2")) {
                        strongCount++;
                    }
                    list.add(0, entity);
                    adapter = new DockingScanAdapter(DockingScanAty.this, list, access, DockingScanAty.this,
                            guideView);
                    mListView.setAdapter(adapter);
                    confirmCount++;
                    count();
                }
            `

`

@Override
public View getView(int position, View convertView, final ViewGroup parent) {
    ViewHolder holder;
    if (convertView == null) {
        holder = new ViewHolder();
        convertView = LayoutInflater.from(context).inflate(R.layout.lv_item_docking_scan, parent, false);
        holder.barcode = (TextView) convertView.findViewById(R.id.item_tv_barcode);
        holder.goodsName = (TextView) convertView.findViewById(R.id.item_tv_goodsName);
        holder.songSta = (TextView) convertView.findViewById(R.id.item_tv_songSta);
        holder.tips = (TextView) convertView.findViewById(R.id.item_tv_tips);
        holder.checkBox = (CheckBox) convertView.findViewById(R.id.item_cb);
        holder.goodsMark = (TextView) convertView.findViewById(R.id.item_tv_scanGoodsMark);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    DockingScanEntity entity = getData(position);
    if (entity != null) {
        holder.barcode.setText(entity.getBarcode());
        if (!entity.getNum().equals("1.00")) {
            holder.goodsName.setText("商品:" + entity.getGoods() + "(" + entity.getNum() + "平方)");
        } else {
            holder.goodsName.setText("商品:" + entity.getGoods());
        }
        if (ValueUtils.isStrNotEmpty(entity.getGoodinfo())) {
            holder.goodsMark.setText("备注:" + entity.getGoodinfo());
            holder.goodsMark.setVisibility(View.VISIBLE);
        } else {
            holder.goodsMark.setVisibility(View.GONE);
        }
        holder.songSta.setText("送件网点:" + entity.getSong_serverid());
        if (ValueUtils.isStrNotEmpty(entity.getStyle())) {
            if (entity.getStyle().equals("2")) {// 强装显示tips
                holder.tips.setVisibility(View.VISIBLE);
            } else {
                holder.tips.setVisibility(View.GONE);
            }
        }
        holder.checkBox.setChecked(isSelected.get(position));
        LogUtils.i("position--->>>" + position);
        LogUtils.i("convertView--->>>" + convertView);
        if (position == 0) {
            guideView.setHighLightView(convertView);
        }
    }

    final View view = convertView;
    final int p = position;
    final int change = holder.checkBox.getId();
    holder.checkBox.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            clickListener.onClick(view, parent, p, change);
        }
    });

    return convertView;
}

private class ViewHolder {
    TextView barcode;
    TextView goodsName;
    TextView songSta;
    TextView tips;
    CheckBox checkBox;
    TextView goodsMark;
}`

from highlight-guideview.

yilylong avatar yilylong commented on June 13, 2024

DockingScanEntity entity = getData(position); 没联网获取数据前 你这个entitiy有值吗 可以调试下

from highlight-guideview.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.