package com.example.dictionary.mRecyclerView;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView list_title;
public TextView list_desc;
public ViewHolder(View itemView) {
super(itemView);
list_title = (TextView) itemView.findViewById(R.id.list_title);
list_desc = (TextView) itemView.findViewById(R.id.list_desc);
}
}
in itemView.findViewById(R.id.list_title) and itemView.findViewById(R.id.list_desc) I get an error in R error message : package R does not exist
This is definitely code that should work. But this code is not running in my android studio. How can I get this code to work?
list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/list_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="리스트 화면"
android:textColor="#fff"
android:background="#36384F"
android:textSize="20sp"
android:paddingLeft="20dp"
android:paddingTop="20dp"
android:paddingBottom="10dp"/>
<TextView
android:id="@+id/list_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="리스트 내용"
android:textColor="#fff"
android:background="#36384F"
android:textSize="15sp"
android:maxLines="2"
android:ellipsize="end"
android:paddingLeft="20dp"
android:paddingBottom="20dp"/>
</LinearLayout>