recycleview강의에서 4분 12초에 .adapter부분이 빨간색이 떠요.
449
35 asked
7번째 recycleview강의라서 여기서 질문올렸어요.
ChatListActivity.kt
package com.example.chatting_video
import Model.UserItem
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.xwray.groupie.GroupAdapter
import com.xwray.groupie.GroupieViewHolder
import kotlinx.android.synthetic.main.activity_chat_list.*
class ChatListActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_chat_list)
val adapter = GroupAdapter<GroupieViewHolder>()
adapter.add(UserItem())
adapter.add(UserItem())
adapter.add(UserItem())
recyclerview_list.adapter = adapter
}
}
.adapter부분이 빨간색이 떠요. = adapter는 괜찮아요.
adapter부분에 뭐가 빠져서 빨간색이 뜨는것 같아요.
오류는 아래와 같아요
e: C:\Users\MS\AndroidStudioProjects\chatting_video\app\src\main\java\com\example\chatting_video\ChatListActivity.kt: (21, 27): Unresolved reference: adapter
UserItem.kt
package Model
import android.content.ClipData
import com.example.chatting_video.R
import com.xwray.groupie.GroupieViewHolder
import com.xwray.groupie.Item
class UserItem : Item<GroupieViewHolder>() {
override fun getLayout(): Int {
return R.layout.message_list_row
}
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
}
}
activity_chat_list.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recyclerview_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ChatListActivity">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="344dp"
android:layout_height="572dp"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="40dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.761"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.632" />
</androidx.constraintlayout.widget.ConstraintLayout>
Answer 3
0
recyclerview에 id를 달아주지 않았기 때문에 에러가 나는 겁니다.
recyclerview에 익숙하지 않다면 연습 후, 강의를 들으시면 어려움이 덜하실거에요!
https://www.youtube.com/watch?v=6Gm3eMG8KqI
0
이 코드를
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recyclerview_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ChatListActivity">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="344dp"
android:layout_height="572dp"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="40dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.761"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.632" />
</androidx.constraintlayout.widget.ConstraintLayout>
아래와 같이 변경해주세요~
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ChatListActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview_list"
android:layout_width="344dp"
android:layout_height="572dp"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="40dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.761"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.632" />
</androidx.constraintlayout.widget.ConstraintLayout>
Groupy 라이브러리 지원이 되지 않습니다.
0
172
1
Firebase가 아닌 my sql
0
361
0
4분 3초에서 그룹 어뎁터와 그룹뷰 홀더 빨간색 글씨
0
296
2
7강 RecyclerView 강의에서 질문있습니다.
0
616
3
개복님 말씀대루 다했는데 도중에 앱이 꺼져용
0
412
1
안녕하세요. 말씀하신 import 추가했는데 오류가 또 뜨네요 ㅠ
0
479
2
안녕하세욤 강의 잘보고 있습니다
0
292
2
파이어스토어,리얼타임데이터베이스 uid 관련 질문입니다.
0
311
2
recyclerview_list 이부분이 안뜹니다.
0
276
1
firebase 업데이트 된버전에 코드를 알 수 있을 까요?
0
226
1
Firebase 연동 질문입니다.
0
293
1
auth.createUserWithEmailAndPassword 유저생성이안돼요
0
417
1
개복치님 리사이클러뷰 질문입니다.
0
340
3
.adapter부분이 빨간색이 떠요. 어떤게 빠진건가요?
0
218
1
RecyclerView 7분중 GroupieViewHolder 자동입력과 UserItem을 Implement Members하는법을 모르겠어요.
0
407
3
13강 리얼타임 수강중입니다. 말씀대로 LOG.D(TAG,MSG 결과입니다. )
0
526
6
GroupAdapter와 GroupieViewHolder 자동입력이 안떠요.
0
280
1
auth = FirebaseAuth.getInstance를 auth = Firebase.auth로 바꾸면 오류가 떠요.
0
267
0
빨간색 item을 Import하는 법과 GroupViewHolder 자동입력되는 법과 Try it out:2.9.0 다운받는 법좀 알려주세요!
0
259
0
13강 리얼타임 수강중입니다.
0
442
1
ChatListActivity에서 디자인 (or 텍스트) 메뉴가 없어서 리사이클뷰를 키지 못합니다.
0
342
0
이 코드를 어디에 넣는건가요? db.collection(
0
252
0
빨간색 글씨때문에 막혀요. 그리고 Cloud Firestore 초기화 코드가 달라요.
0
945
2
chatting_video 타이틀 제거가 안되요.
0
241
2

