java - 膨胀 View 时 WebCachedImageView 解析 XML 时出错

标签 java android xml imageview

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

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

WebCachedImageView 元素位于具有数组适配器的 ListView 的布局单元中,我收到此错误:

>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 中,但如果我放置它,也不会改变。

有什么想法吗?我怀疑自定义组件的链接/注册中存在某些问题。

最佳答案

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

关于java - 膨胀 View 时 WebCachedImageView 解析 XML 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22794043/

相关文章:

java - @Scheduled with cron 表达式突然停止工作

java - 将大型 xml 文件加载到 Snowflake 中并按标签压平

java - Stanford Core NLP - 理解共指消解

java - 创建测验应用程序 - 使用 View

android - android in-app billing v3 api中的开发人员有效负载应该是什么?

javascript - 检索 XML 文档中的 HTML 元素

java - 当再次新选择同一项目时, ListView 中项目的属性更改(或设置为新属性)

android - 无法使用 mkdirs() 创建目录 - android

xml - 如何使 XStream 在解析 XML 时跳过未映射的标签?

java - 在客户端使用 GWT 构建 RSS