Как исправить ошибку - Unresolved reference: Layout_ActivityBinding?

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

Создаю Мобильное приложение для курсовой на Kotlin. Столкнулся с проблемой что я не могу почему-то вложить fragment в FragmentContainerView. В инете я не нашёл по крайне мере как исправить.

Код в gradle

    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.example.historicalsaratovnav"
        minSdk 28
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    dataBinding{enabled=true}

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
}

dependencies {

    implementation 'androidx.core:core-ktx:1.9.0'
    implementation 'androidx.appcompat:appcompat:1.6.0'
    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation 'com.google.android.material:material:1.8.0'
    implementation("androidx.navigation:navigation-fragment-ktx:2.5.3")
    implementation("androidx.navigation:navigation-ui-ktx:2.5.3")
    implementation 'androidx.core:core-splashscreen:1.0.0'
    implementation "androidx.fragment:fragment-ktx:1.6.0-alpha04"
}

Код разметки

<androidx.drawerlayout.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".Layout_Activity">

    <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
    >
        <androidx.fragment.app.FragmentContainerView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal"
                android:weightSum="1"
                android:id="@+id/conteiner_fragment"
                app:defaultNavHost="true"
                android:gravity="center"/>
        <com.google.android.material.bottomnavigation.BottomNavigationView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                app:labelVisibilityMode="labeled"
                android:background="@color/white"
                app:menu="@menu/menu"
                android:id="@+id/bottom_navigation_view"
        >
        </com.google.android.material.bottomnavigation.BottomNavigationView>

    </FrameLayout>

</androidx.drawerlayout.widget.DrawerLayout>

Код файла KT


import android.content.Context
import android.os.Binder
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.AttributeSet
import android.view.View


class Layout_Activity : AppCompatActivity() {

    lateinit var binding: Layout_ActivityBinding


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = Layout_ActivityBinding.inflate(layoutInflater)
        setContentView(binding.root)

        binding.Main.setOnClickListener {

            replaceFragment(Main_App_Screen_Fragment())

        }

        binding.List.setOnClickListener {

        }

        binding.Map.setOnClickListener {

        }

        binding.Profile.setOnClickListener {

        }

        binding.Settings.setOnClickListener {

        }
    }

    private fun replaceFragment(fragment: Main_App_Screen_Fragment) {
        val fragmentManager = supportFragmentManager
        val fragmentTransaction = fragmentManager.beginTransaction()
        fragmentTransaction.replace(R.id.conteiner_fragment, fragment)
        fragmentTransaction.commit()
    }
}

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

Ответы

Ответов пока нет.