在膨胀视图时WebCachedImageView错误解析XML

时间:2014-04-01 18:33:17

标签: java android xml imageview

我正在使用https://github.com/leocadiotine/WebCachedImageView

中的WebCachedImageView

我认为我正确地完成了项目之间的链接,JAVA文件可以识别WebCachedImageView类并且编译没有任何问题,但XML部分不能

WebCachedImageView元素位于列表视图的布局单元格中,该列表视图具有适合它的数组适配器,我收到此错误:

>FATAL EXCEPTION: main
>android.view.InflateException: Binary XML file line #31: Error inflating class android.view.WebCachedImageView
>at android.view.LayoutInflater.createView(LayoutInflater.java:613)
>at android.view.LayoutInflater.onCreateView(LayoutInflater.java:643)
>at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
>at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
>at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
>at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
>at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
>at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
>at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
>at br.com.geen.istunning.view.ShoppingArrayAdapter.getView(ShoppingArrayAdapter.java:41)

数组适配器(部分):

import android.view.WebCachedImageView;

public class ShoppingArrayAdapter extends ArrayAdapter<Shopping> {

private final Context context;
private final Shopping[] values;

public ShoppingArrayAdapter(Context context, Shopping[] values) {
    super(context, R.id.mainListView, values);
    this.context = context;
    this.values = values;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    Shopping spc = values[position];

    LayoutInflater inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    //line 41 below, the one that points to the error in the stack trace
    View rowView = inflater.inflate(R.layout.cell_listview, parent, false);
    //Compiles ok! Import ok!
    WebCachedImageView icon = (WebCachedImageView)rowView.findViewById(R.id.icon);

    TextView nomePeca = (TextView) rowView.findViewById(R.id.titleList);
    TextView nomeVendedora = (TextView) rowView
            .findViewById(R.id.descriptionList);
    TextView valor = (TextView) rowView.findViewById(R.id.valueList);
    nomePeca.setText(spc.getNome());
    nomeVendedora.setText(spc.getNome_dona());
    valor.setText("R$ " + spc.getValor_para_venda());
    icon.setImageUrl(spc.getUrl_imagem());
    //setImages(spc.getUrl_imagem(), rowView);

    return rowView;
}

XML有:

    <WebCachedImageView android:id="@+id/icon" />

但是eclipse没有自动完成功能,也没有识别自定义的“app:”命名空间,当前不在XML中,但如果我把它放在那里就不会改变。

有什么想法吗?我怀疑链接/注册自定义组件有什么。

1 个答案:

答案 0 :(得分:1)

您是如何链接项目的?您是否将WebCachedImageView添加为Android库项目?