Ошибка DataBinding Android (Cannot inherit from final 'ru.uch.databinding.ItemDocScanTableBinding')

Рейтинг: 0Ответов: 1Опубликовано: 09.05.2023

Объясните почему может возникать ошибка Cannot inherit from final 'ru.uch.databinding.ItemDocScanTableBinding' Точнее это не ошибка, а просто Android Studio в автоматически сгенерированом классе подчёркивыет его красной чертой

введите сюда описание изображения

Слой фрагмента

<?xml version="1.0" encoding="utf-8"?>
  <layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

<data>

    <variable
        name="modelDoc"
        type="ru.uch.viewModelUchMK.ViewModelDoc" />

    <variable
        name="myAdapter"
        type="ru.uch.adapterUchMK.AdapterList" />

</data>

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#888"
        android:stretchColumns="*"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#888"
            android:orientation="vertical">

            <TextView
                android:id="@+id/textColor"
                android:layout_width="10dp"
                android:layout_height="wrap_content"
                android:background="#7fc342"
                android:gravity="center"
                android:text="@string/column_name_color"
                android:textSize="20sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/textSize"
                android:layout_width="40dp"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/column_name_size"
                android:textSize="20sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/textDefect"
                android:layout_width="15dp"
                android:layout_height="wrap_content"
                android:background="#7fc342"
                android:gravity="center"
                android:text="@string/column_name_defect"
                android:textSize="20sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/textGrey"
                android:layout_width="30dp"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/column_name_grey"
                android:textSize="20sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/textCount"
                android:layout_width="50dp"
                android:layout_height="wrap_content"
                android:background="#7fc342"
                android:gravity="center"
                android:text="@string/column_name_count"
                android:textSize="20sp"
                android:textStyle="bold" />
        </TableRow>

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerViewItem"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:adapter="@{myAdapter}"
            tools:listitem="@layout/item_doc_scan_table"/>

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#888"
            android:baselineAligned="false"
            android:orientation="vertical">

            <TextView
                android:id="@+id/textEmpty"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_span="4"
                android:gravity="center"
                android:text=""
                android:textStyle="bold" />

            <TextView
                android:id="@+id/textCountAll"
                android:layout_width="50dp"
                android:layout_height="wrap_content"
                android:background="#7fc342"
                android:gravity="center"
                android:text="@{String.valueOf(modelDoc.countAllBarDoc)}"
                android:textSize="20sp"
                android:textStyle="bold" />
        </TableRow>
    </TableLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

И такая "беда" у всех классов автоматически созданных.

введите сюда описание изображения

Ответы

▲ 0Принят

Придется видимо оставить всё как есть. Благо на работу это никак не влияет. Но всё равно, внутренне эта ситуация вызывает отторжение.. :(