gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 13:11:53 25 4
gpt4 key购买 nike

我正在使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com