У меня есть класс FirestoreAdapter
override fun onCreateViewHolder(parent: ViewGroup, p1: Int): ViewHolder {
val layoutInflater: LayoutInflater = LayoutInflater.from(parent.context)
val matchItemBinding: MatchItemBinding =
DataBindingUtil.inflate(layoutInflater, R.layout.match_item, parent, false)
return ViewHolder(matchItemBinding)
}
Макет match_item содержит несколько AppCompatTextViews
Некоторые текстовые представления работают отлично
matchItemBinding.tvAwayTeamName.text = match.teams[1].name
Код XML:
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_home_team_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/unit_dp_10"
android:layout_marginTop="@dimen/unit_dp_10"
android:layout_marginEnd="@dimen/unit_dp_10"
android:layout_marginRight="@dimen/unit_dp_10"
android:textSize="@dimen/unit_sp_18"
app:fontFamily="@font/avenir_next_bold"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/iv_logo_home_team"
app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/lorem" />
Но когда я пытаюсь сделать для другого просмотра текста, я получаю сообщение об ошибке
matchItemBinding.tv_text_vs.text = match.date
XML-код:
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_text_vs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@tools:sample/lorem"
app:fontFamily="@font/avenir_next_semi_bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Error: Unresolved reference: tv_text_vs