userRecyclerView.layoutManager = LinearLayoutManager(this, LinearLayout.VERTICAL, false)
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@ id/userRecyclerView"/>
I saw a code tutorial video. When he used "userRecyclerview", it says "userRecyclerview" comes from the second code I post above. But it did not come out when I write "userRecyclerview", also there is a Unresolved reference problem.
CodePudding user response:
Seems like they're using Kotlin synthetics to bind the view.
Kotlin synthetics will generate some extra code that will allow you to access views in the layout XML, just as if they were properties with the name of the id you used in the layout definition.
But it has been deprecated already. So to access your views either use findViewById() or replace Kotlin synthetics
with Jetpack view binding following this: https://developer.android.com/topic/libraries/view-binding/migration