SwipeDelMenuLayout icon indicating copy to clipboard operation
SwipeDelMenuLayout copied to clipboard

Binary XML file line #27: Error inflating class <unknown>

Open AXwjg opened this issue 6 years ago • 0 comments

直接给代码, 之前这样用好像没问题

布局文件

<com.mcxtzhang.swipemenulib.SwipeMenuLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="120dp" android:clickable="true" android:paddingBottom="1dp" app:ios="false" app:leftSwipe="true" app:swipeEnable="true">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/type_of_tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="10dp"
        android:text="损伤性"
        android:textColor="@color/current_weight_tv"
        android:textSize="@dimen/item_type" />

    <TextView
        android:id="@+id/time_tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginRight="10dp"
        android:text="日期"
        android:textColor="@color/current_weight_tv"
        android:textSize="@dimen/item_time_qrcede" />

    <TextView
        android:id="@+id/qrcode_tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/time_tv"
        android:layout_alignParentRight="true"
        android:layout_marginRight="10dp"
        android:text="二维码编号"
        android:textColor="@color/current_weight_tv"
        android:textSize="@dimen/item_time_qrcede" />

</RelativeLayout>

<Button
    android:id="@+id/btnDelete"
    android:layout_width="80dp"
    android:layout_height="match_parent"
    android:background="@color/red"
    android:text="@string/delete"
    android:textColor="@android:color/white"
    android:textSize="@dimen/error_correction_text" />

</com.mcxtzhang.swipemenulib.SwipeMenuLayout>

--------------------Adapter-------- public class HistoryAdapter extends BaseAdapter {

private LayoutInflater mInflater;
private List<HistoryBean> dataList;

public HistoryAdapter(Context context, List<HistoryBean> dataList) {
    mInflater = LayoutInflater.from(context);
    this.dataList = dataList;
}

@Override
public int getCount() {
    return getList() == null ? 0 : getList().size();
}

@Override
public Object getItem(int position) {
    return  getList() == null ? null : getList().get(position);
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    if(convertView == null){
        holder = new ViewHolder();
        convertView = mInflater.inflate(R.layout.item_history_list, null);
        holder.typeOf = (TextView) convertView.findViewById(R.id.type_of_tv);
        holder.time = (TextView) convertView.findViewById(R.id.time_tv);
        holder.qrCode = (TextView) convertView.findViewById(R.id.qrcode_tv);
        holder.deleteBtn = (Button) convertView.findViewById(R.id.btnDelete);
        convertView.setTag(holder);
    }
    else{
        holder = (ViewHolder) convertView.getTag();
    }
    holder.typeOf.setText(dataList.get(position).getType());
    holder.time.setText(dataList.get(position).getTime());
    holder.qrCode.setText(dataList.get(position).getQrCode());
    holder.deleteBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            EventBus.getDefault().post(position);
        }
    });
    return convertView;
}

public List<HistoryBean> getList() {
    return dataList;
}

public void setList(List<HistoryBean> list) {
    this.dataList = list;
}


class ViewHolder {
    TextView typeOf;
    TextView time;
    TextView qrCode;
    Button deleteBtn;

}

}

AXwjg avatar Mar 23 '19 10:03 AXwjg