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;
        }
这里出现问题:
if
(convertView == null || children != ((ViewHolder) convertView.getTag()).text.getText()) { Log.d(TAG, "getChildView() - initialize converView");

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

Android Bug BaseExpandableListAdapter, getChildView,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。