我正在使用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中,但是如果我放置它,则不会更改。
有任何想法吗?我怀疑自定义组件的链接/注册中有问题。
最佳答案
您是如何链接项目的?您是否将WebCachedImageView添加为Android Library Project?