2 yangchun dawang yangchun_dawang 于 2016.09.12 14:11 提问

android FancyCoverFlowAdapter加载自定义布局出错

![图片说明](http://img.ask.csdn.net/upload/201609/12/1473660605_837123.png)图片说明

#_请问 _FancyCoverFlowAdapter加载自定义布局出错,到底怎么添加

 @Override
    public View getCoverFlowItem(int position, View reusableView,
            ViewGroup parent) {
        // TODO Auto-generated method stub
        holder = new ViewHolder();
        if (reusableView == null) {
            reusableView = inflater.inflate(R.layout.item_family,parent);
            holder.textView = (TextView) reusableView
                    .findViewById(R.id.tv_familyName);
            holder.imageView = (CircleImageView) reusableView
                    .findViewById(R.id.circle_ImageHeader);
            reusableView.setTag(holder);
        } else {
            holder = (ViewHolder) reusableView.getTag();
        }
        System.out.println("dataName.get(position)"+dataName.get(position));
        System.out.println(holder.textView);
        holder.textView.setText(dataName.get(position));
        if (dataPicture.get(position).equals("null")) {
            holder.imageView.setImageResource(R.drawable.father);
        } else {
            AsyncHttpClient client = new AsyncHttpClient();// 异步加载图片
            client.get(dataPicture.get(position),
                    new AsyncHttpResponseHandler() {

                        @Override
                        public void onSuccess(int arg0, Header[] arg1,
                                byte[] arg2) {
                            // TODO Auto-generated method stub
                            if (arg0 == 200) {
                                L.i("--------图片访问成功-------");
                                BitmapFactory factory = new BitmapFactory();
                                Bitmap bitmap = factory.decodeByteArray(arg2,
                                        0, arg2.length);
                                holder.imageView.setImageBitmap(bitmap);
                            }
                        }

                        @Override
                        public void onFailure(int arg0, Header[] arg1,
                                byte[] arg2, Throwable arg3) {
                            // TODO Auto-generated method stub

                        }
                    });
            MyImageLoader.displayImage_header(dataPicture.get(position),
                    holder.imageView);
        }
        return reusableView;
    }

1个回答

dabocaiqq
dabocaiqq   2016.11.16 01:48
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!