@Pudjak

Почему не находит View в layout?

Страница:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical">
 
    <TextView
        android:id="@+id/tvTitle"
        android:layout_width="match_parent"
        tools:text="Hello World"
        android:textColor="@color/black"
        android:textSize="20sp"
        android:layout_height="wrap_content"/>
    <TextView
        android:id="@+id/tvBody"
        android:layout_width="match_parent"
        tools:text="Hello World"
        android:textSize="14sp"
        android:layout_height="wrap_content"/>
 
</LinearLayout>

Класс:
import android.view.TextureView
import android.view.View
import androidx.recyclerview.widget.RecyclerView
 
class PostAdapter {
}
 
class PostViewAdapter(itemView: View) : RecyclerView.ViewHolder(itemView) {
    private val tvTitle : TextureView = itemView.findViewById(R.id.tvTitle)
    private val tvBody : TextureView = itemView.findViewById(R.id.tvBody)
 
    fun bindView(postModel: PostModel) {
        tvTitle.text
    }
}

Не могу обратиться к полю "text" Unresolved reference. В чем проблема может быть?
  • Вопрос задан
  • 129 просмотров
Пригласить эксперта
Ответы на вопрос 1
iLLuzor
@iLLuzor
Java, Kotlin, Android Developer
Почему тип TextureView? Надо поменять на TextView
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы