Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AXwjg opened this issue Mar 23, 2019 · 0 comments
Open

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

AXwjg opened this issue Mar 23, 2019 · 0 comments

Comments

@AXwjg
Copy link

AXwjg commented Mar 23, 2019

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

布局文件

<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;

}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant