Notice
Recent Posts
Recent Comments
Link
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

🌱 dreaming DiNO

[Android Studio] RecyclerView 본문

Android/Android Studio

[Android Studio] RecyclerView

MK_____ 2021. 11. 1. 16:33

예제랑 내꺼 왜 다를까,,,

 

strings.xml 에 가져다 쓸 string들을 정리

 

main.xml 

1. 레이아웃 -> constraint로 변경 후, recyclerview 추가

2. id도 지정 "recyclerView" (앞으로 design에서 하지 말고 code에서 지정하는 버릇을 들이자)

my_row.xml 추가

CardView 안에

ImageView, TextView1, TextView2 세개 추가하여 id 값 지정!

 

MainActivity.java 

1. Title 과 Description을 써줄 String [] 선언과 만들어줄 recyclerView 선언

2. drawable에 넣어준 images들을 찾아서 배열에 할당 (image들은 int) 

 

 

 

recyclerView를 핸들링할 MyAdapter.java 생성 

Q1. MainActivity.java에서 선언해준 s1, s2, image = data1, data2, images 인데 왜 똑같이 안썼는가? 

-> 같은 것이라도 클래스가 다르고 구별하서 쓰임을 하려고 한 것 같음

 


내것과 예제,,, 왜죠,, 왜 다른거죠,,,,,,,,,,