错误追踪:
致命异常:主要的 进程:com.example.user.itekit,PID:23028 android.view.InflateException: 二进制XML文件第87行:错误 填充类 com.elyeproj.loaderviewlibrary.LoaderImageViewImageView 在LayoutInflater.java中创建视图:764) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:813)中 在android.view.LayoutInflater.rInflate(LayoutInflater.java:821)中 在android.view.LayoutInflater.inflate(LayoutInflater.java:511)中 在android.view.LayoutInflater.inflate(LayoutInflater.java:415)中 在android.view.LayoutInflater.inflate(LayoutInflater.java:366)中 在com.example.user.itekit.ListbaseAdapter.getView(ListbaseAdapter.java:74)中 在android.widget.AbsListView.obtainView(AbsListView.java:2842)中 在android.widget.ListView.measureHeightOfChildren(ListView.java:1290)中 在android.widget.ListView.onMeasure(ListView.java:1202)中 在com.example.user.itekit.ExpandableHightListView.onMeasure(ExpandableHightListView.java:36)中 在android.view.View.measure(View.java:18425)中 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5802)中 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1835)中 在android.widget.LinearLayout.measureVertical(LinearLayout.java:725)中 在android.widget.LinearLayout.onMeasure(LinearLayout.java:616)中 在android.view.View.measure(View.java:18425)中 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5802)中 在android.widget.FrameLayout.onMeasure(FrameLayout.java:430)中 在android.view.View.measure(View.java:18425)中 在android.widget.ScrollView.measureChildWithMargins(ScrollView.java:2015)中 在android.widget.FrameLayout.onMeasure(FrameLayout.java:430)中 在android.widget.ScrollView.onMeasure(ScrollView.java:484)中 在android.view.View.measure(View.java:18425)中 在android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728)中 在android.widget.RelativeLayout.onMeasure(RelativeLayout.java:464)中 在android.view.View.measure(View.java:18425)中 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5802)中 在android.widget.FrameLayout.onMeasure(FrameLayout.java:430)中 在android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)中 在android.view.View.measure(View.java:18425)中 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5802)中 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1835)中 在android.widget.LinearLayout.measureVertical(LinearLayout.java:725)中 在android.widget.LinearLayout.onMeasure(LinearLayout.java:616)中 在android.view.View.measure(View.java:18425)中 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5802)中 在android.widget.FrameLayout.onMeasure(FrameLayout.java:430)中 在android.view.View.measure(View.java:18425)中 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5802)中 在android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1835)中 在android.widget.LinearLayout.measureVertical(LinearLayout.java:725)中 在android.widget.LinearLayout.onMeasure(LinearLayout.java:616)中 在android.view.View.measure(View.java:18425)中 在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5802)中 在android.widget.FrameLayout.onMeasure(FrameLayout.java:430)中 在com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2881)中 在android.view.View.measure(View.java:18425)中 在android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2237)中 在android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1295)中 在android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1537)中 在android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1180)中 在android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6558)中 在android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)中 在android.view.Choreographer.doCallbacks(Choreographer.java:590)中 在android.view.Choreographer.doFrame(Choreographer.java:560)中 在android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)中 在android.os.Handler.handleCallback尝试使用来自https://android-arsenal.com/details/1/4243#!description的Android Loader View。
理想情况是:将加载效果应用于我的视图中的图片和文本,就像链接所展示的一样。
问题在于,每当我尝试通过适配器实现它时,我都会得到标题所述的错误。
以下是代码片段:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (convertView == null) {
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = layoutInflater.inflate(R.layout.list, null);
viewHolder = new ViewHolder();
viewHolder.image = (LoaderImageView)convertView.findViewById(R.id.image);
viewHolder.title = (LoaderTextView)convertView.findViewById(R.id.title);
viewHolder.subtitle = (LoaderTextView)convertView.findViewById(R.id.subtitle);
viewHolder.shop = (LoaderTextView)convertView.findViewById(R.id.shop);
convertView.setTag(viewHolder);
}else {
viewHolder = (ViewHolder)convertView.getTag();
}
BeanclassTourCategory bean = (BeanclassTourCategory)getItem(position);
Picasso.with(context)
.load(bean.getImage())
.fit()
.into(viewHolder.image);
viewHolder.title.setText(bean.getTitle());
viewHolder.subtitle.setText(bean.getSubtitle());
viewHolder.shop.setText(bean.getShop());
return convertView;
}
A) 这个错误有可能的解决方案吗?
B) 有没有其他的加载器视图可以与适配器轻松实现?