Android Bug BaseExpandableListAdapter, getChildView

Android Bug BaseExpandableListAdapter, getChildView
        @Override
        public View getChildView(final int groupPosition, final int childPosition,
                boolean isLastChild, View convertView, ViewGroup parent) {
            Log.d(TAG, "getChildView() group="+groupPosition+", child="+childPosition);
            final String children = (String) getChild(groupPosition,childPosition);
            if (convertView == null || children != ((ViewHolder) convertView.getTag()).text.getText()) {
                Log.d(TAG, "getChildView() - initialize converView");
                LayoutInflater inflater = LayoutInflater.from(context); 
                convertView = inflater.inflate(R.layout.expandable_list_row, null);
                ViewHolder viewHolder = new ViewHolder();
                viewHolder.text = (TextView) convertView.findViewById(R.id.textView1);
                viewHolder.image = (ImageView) convertView.findViewById(R.id.imageCheck);
                convertView.setTag(viewHolder);            
                convertView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Log.e("test","group="+groupPosition+", child="+childPosition);
                        final ImageView imageCheck = (ImageView)v.findViewById(R.id.imageCheck);
                        imageCheck.setVisibility(ImageView.VISIBLE);
                        int dialogType = getAntecedentType(groupPosition, childPosition);
                        int antecedentId = getAntecedentId(groupPosition, childPosition);
                        if(antecedentId != -1) {
                            MedicalAntecedentDialog dialog = dialogs.get(antecedentId);
                            if(dialog != null) {
                                dialog.show();
                            }
                            else {
                                MedicalAntecedentDialog dialog2 = new MedicalAntecedentDialog(context, children, dialogType);
                                dialogs.append(antecedentId, dialog2);
                                dialog2.show();
                            }
                        }
                    }
                });
            }
            ViewHolder holder = (ViewHolder) convertView.getTag();
            holder.text.setText(children);
            return convertView;
        }
Android Bug BaseExpandableListAdapter, getChildView
这里出现问题:
if
(convertView == null || children != ((ViewHolder) convertView.getTag()).text.getText()) { Log.d(TAG, "getChildView() - initialize converView");

Group1里前9项都被初始化了,而第十个和第十一个没有,第十二个元素初始化正确。不知道为什么。。。

Android Bug BaseExpandableListAdapter, getChildView,布布扣,bubuko.com

Android Bug BaseExpandableListAdapter, getChildView

上一篇:一个很Nice的Android Banner轮播图库


下一篇:011_品优购02