๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋นˆ ๊ตฌ๋ฉ ์ฑ„์šฐ๊ธฐ

[Android][RecyclerView][NestedScrollView] ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ๋ทฐ ์„ฑ๋Šฅ ํ–ฅ์ƒ

์‹œ์ž‘

์ด๋ฒˆ ํ”„๋กœ์ ํŠธ์—์„œ '์Šต๊ด€ ๊ธฐ๋ฅด๊ธฐ'๋ผ๋Š” ํ…Œ๋งˆ๋กœ 3, 7, 21, 30, 66์ผ์˜ ์‚ฌ์ง„ ์ธ์ฆ ๋ฆฌ์ŠคํŠธ ํ™”๋ฉด์„ ๊ฐœ๋ฐœํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค.

ํ™”๋ฉด์— ๊ธฐ๋ฅด๊ณ ์ž ํ•˜๋Š” ์Šต๊ด€์˜ ์ •๋ณด๋“ค๊ณผ ์ธ์ฆ ์‚ฌ์ง„ ๋ฆฌ์ŠคํŠธ(์ž‘์€ ์ •์‚ฌ๊ฐํ˜• ์ด๋ฏธ์ง€๋“ค์ด ๊ฐ€๋กœ 3 X ์„ธ๋กœ n์ค„๋กœ ๋…ธ์ถœ๋จ)๊ฐ€ ๋ชจ๋‘ ๋‚˜์™€์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์—, NestedScrollView๋ฅผ root view๋กœ ๋‘๊ณ  ํ™”๋ฉด layout์„ ๊ตฌ์„ฑํ–ˆ๋‹ค. ์Šต๊ด€๊ณผ ์ด๋ฏธ์ง€ ์ •๋ณด๋“ค์€ ํ™”๋ฉด ์ง„์ž… ์‹œ ์„œ๋ฒ„์—์„œ ๋ฐ›์•„์™€ ๋…ธ์ถœํ•œ๋‹ค.

๋ฟŒ๋“ฏํ•˜๊ฒŒ ๋‹ค ๋งŒ๋“ค๊ณ  ๋‚˜์„œ, ํ…Œ์ŠคํŠธ๋ฅผ ํ•˜๋Š”๋ฐ 66์ผ์น˜ ํ™”๋ฉด์€ ์„ฑ๋Šฅ์ด ๋„ˆ๋ฌด ๊ตฌ๋ ธ๋‹ค. ํ™”๋ฉด์ด ๋กœ๋“œ๋˜๋Š” ์‹œ๊ฐ„์ด ์˜ค๋ž˜ ๊ฑธ๋ ธ๋‹ค. ์ด๋ฅผ ๊ฐœ์„ ํ•˜๊ณ ์ž ๋งˆ์Œ ๋จน๊ณ  ์ž‘์—…์— ๋‚˜์„ ๋‹ค.

 

์™œ ์„ฑ๋Šฅ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š”๊ฐ€

NestedScrollView๊ฐ€ ์–ด๋–ป๊ฒŒ ๋Œ์•„๊ฐ€๋Š”์ง€ ์•Œ๊ฒŒ ๋˜์—ˆ๋‹ค.

https://stackoverflow.com/a/44581288

 

Recycler View loading very slow for large data when inside NestedScrollView

I have added RecyclerView inside my NestedScrollView. Basically I want RecyclerView to scroll with other Views. The problem that I am facing is that for a small set of data, it is working fine, but...

stackoverflow.com

RecyclerView์˜ ํŠน์ง•์ด ๋ทฐ์˜ ์žฌ์‚ฌ์šฉ์ธ๋ฐ, ์•Œ๊ณ ๋ณด๋‹ˆ NestedScrollView๋Š” ๋ทฐ๋“ค์„ ๊ฒฐ์ฝ” ์žฌ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ๊ฑฐ์˜€๋‹ค. NestedScrollView๋Š” ์ž์‹ RecyclerView์˜ ๋ทฐ๋“ค์„ ์ฒ˜์Œ์— onCreateViewHolder()๋กœ ์‹ธ๊ทธ๋ฆฌ ๋ชจ๋‘ ๋‹ค ๋งŒ๋“ค์–ด ๋†“๊ณ  ์‹œ์ž‘ํ–ˆ๋˜ ๊ฑฐ์˜€๋‹ค. ์ฒ˜์Œ์— ํ™”๋ฉด์— ์ง„์ž…ํ•ด์„œ 66๊ฐœ์˜ ๋ทฐ๋“ค์„ ๋‹ค ์ƒ์„ฑํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์„ฑ๋Šฅ์ด ๋–จ์–ด์ง€๋Š” ๊ฒƒ์ด์—ˆ๋‹ค.

์•ˆ๋“œ๋กœ์ด๋“œ ๋””๋ฒจ๋กœํผ์Šค ๊ณต์‹๋ฌธ์„œ์—์„œ๋Š” NestedScrollView์— ๋Œ€ํ•ด ์ƒ์„ธ ์„ค๋ช…์„ ๋ชป ์ฐพ์•„์„œ, stack overflow๋ฅผ ํ†ตํ•ด์„œ ์•Œ๊ฒŒ๋˜์—ˆ๋‹ค. 

 

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ์ฐพ๊ธฐ ์‹œ๋„

๋ฌธ์ œ ํ•ด๊ฒฐ์„ ์œ„ํ•ด ์—ฌ๋Ÿฌ ์‹œ๋„๋ฅผ ํ•œ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๊ทธ ์–ด๋–ค ์‹œ๋„๋ฅผ ํ•ด๋„, ๋ฌธ์ œ์˜ ๊ทผ๋ณธ ์›์ธ์€ NestedScrollView์˜€๊ธฐ์— NestedScrollView๋ฅผ ์•ˆ์“ฐ๋Š” ๊ฒŒ ๊ฐ€์žฅ ์„ฑ๋Šฅ์ด ์ข‹์•˜๋‹ค.

 

1) ์ฒซ ์‹œ๋„. NestedScrollView ์•ˆ์˜ ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ๋ทฐ์˜ ๋†’์ด๋ฅผ ๋ฏธ๋ฆฌ ์ง€์ •ํ•˜๊ธฐ.

https://stackoverflow.com/a/42808874

 

RecyclerView item height and width change dynamically Android

I am new to android development and I am developing an app where the app downloads pictures from server and show them in a gridView. But some extra spaces are coming up when the app is run on a big...

stackoverflow.com

์„ฑ๋Šฅ ๊ฐœ์„ ์ด ๋ฏธ๋ฏธํ•˜๋‹ค. NestedScrollView๋ฅผ ์“ฐ๋‹ˆ๊นŒ... 66๊ฐœ ๋‹ค ์ฒ˜์Œ์— ๋งŒ๋“œ๋‹ˆ๊นŒ.๐Ÿคฆ‍โ™€๏ธ

 

2) ๋‘ ๋ฒˆ์งธ ์‹œ๋„. Adapter์˜ ๋ทฐ ํƒ€์ž…์œผ๋กœ ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ๋ทฐ๋ฅผ ๋„ฃ์Œ. 

RecyclerView๋ฅผ ViewHolder ๋กœ ํ•œ ๋ฒˆ ๋” ๊ฐ์‹ธ์ค€ ๊ฒƒ์ด๋‹ค. NestedScrollView ์•ˆ์— ์žˆ์œผ๋‹ˆ ์–ด์งœํ”ผ ์„ฑ๋Šฅ ๊ฐœ์„ ์€ ์—†๋‹ค. ์™œ ์ด๋Ÿฐ ์‹œ๋„๋ฅผ ํ–ˆ์—ˆ๋Š”์ง€ ์ง€๊ธˆ์€ ์ดํ•ด๊ฐ€ ์•ˆ ๊ฐ„๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๋Š”๋ฐ, Wrapper ํ•˜๋‚˜๊ฐ€ ์ƒ๊ธฐ๋ฉด ๋ญ”๊ฐ€ ๋‹ฌ๋ผ์ง€์ง€ ์•Š์„๊นŒ๋ž€ ํฌ๋ง์„ ๋ถ™์žก๊ณ  ์‹ถ์–ดํ–ˆ๋˜ ๊ฑฐ ๊ฐ™๋‹ค๐Ÿ™„ 

 

3) ์„ธ ๋ฒˆ์งธ ์‹œ๋„. NestedScrollView๋ฅผ ์—†์• ๊ณ , RecyclerView ํ•˜๋‚˜๋ฅผ root view๋กœ ๋‘”๋‹ค. ์Šต๊ด€ ์ •๋ณด์— ๋Œ€ํ•œ UI๋“ค์„ ๋„ฃ์€ Header Adapter์™€, ๊ธฐ์กด ์ธ์ฆ ๋ฆฌ์ŠคํŠธ Adapter๋ฅผ ConcatAdapter๋กœ ๋ฌถ์–ด ์‚ฌ์šฉํ•œ๋‹ค.

์„ฑ๋Šฅ ๊ฐœ์„ ์ด ๋งŽ์ด ์ด๋ฃจ์–ด์กŒ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ์Šคํฌ๋กค ์‹œ ๋ฒ„๋ฒ…์ธ๋‹ค. 

์ตœ์ดˆ ํ™”๋ฉด ๋กœ๋“œ ์‹œ๊ฐ„์ด ์ค„์–ด ๋“ค์—ˆ๋‹ค๋Š” ์„ฑ๋Šฅ ๊ฐœ์„ ์€ ์ด๋ฃจ์–ด์กŒ์ง€๋งŒ, ํ•ด๊ฒฐํ•ด์•ผํ•  ์ด์Šˆ๋“ค์ด ์žˆ๋‹ค.

> 1. ์Šคํฌ๋กค ์‹œ ํ™”๋ฉด์ด ๋ฒ„๋ฒ…์ธ๋‹ค.

> 2. Header Adpater์™€ ๊ธฐ์กด Adapter์™€ ํ•˜๋‚˜์˜ LayoutManager๋ฅผ ๊ณต์œ ํ•œ๋‹ค. Header Adpater๋Š” vertical LinearLayoutManager๋ฅผ ์“ฐ๋Š” ๊ฒŒ ๋งž๊ณ (๋‹ค๋ฅธ ๋ง๋กœ ํ•˜์ž๋ฉด span count๊ฐ€ 1์ธ GridLayoutManger), ๊ธฐ์กด Adapter๋Š” span count๊ฐ€ 3์ธ GridLayoutManager๋ฅผ ์“ฐ๋Š” ๊ฒŒ ์ ํ•ฉํ•œ ์ƒํƒœ๋‹ค.

 

4) ๋„ค ๋ฒˆ์งธ ์‹œ๋„. ConcatAdapter ์šฉ ์ปค์Šคํ…€ Adapter ๋งŒ๋“ค๊ธฐ 

https://medium.com/@gsaillen95/how-to-inflate-different-layoutmanagers-for-each-adapter-with-concatadapter-76cdee6266ca

 

How to inflate different LayoutManagers for each adapter with ConcatAdapter

Since ConcatAdapter has been announced at recyclerview:1.2.0-alpha04 now we can merge different types of our UI into one recyclerview.

medium.com

์„ธ ๋ฒˆ์งธ ์‹œ๋„์—์„œ ์„œ๋กœ ๋‹ค๋ฅธ LayoutManger๋ฅผ ์จ์•ผํ•˜๋Š” Adapter๋“ค์„ ConcatAdapter๋กœ ๋ฌถ์–ด์•ผ ํ•˜๋Š” ์ด์Šˆ๋ฅผ ๊ณ ๋ฏผํ•˜๋‹ค๊ฐ€ ๋ฐœ๊ฒฌํ•จ. ๊ฒฐ๊ตญ์—” Wrapper Adapter๋ฅผ ์“ด๋‹ค. ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ๋ทฐ ์•ˆ์— ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ ๋ทฐ ๋˜ ํ•˜๋‚˜ ๋„ฃ๋Š” ๊ฒƒ์ด์—ˆ๋‹ค. ์„ฑ๋Šฅ ๊ฐœ์„ ์ด๋‚˜, ๊ตฌํ˜„ ๋ฐฉ์‹์ด๋‚˜ ๋”ฑํžˆ ๋ฉ”๋ฆฌํŠธ๋ฅผ ์ฐพ์ง€ ๋ชปํ–ˆ๋‹ค.

 

์„ ํƒํ•œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

์„ธ ๋ฒˆ์งธ ๋ฐฉ๋ฒ•์„ ์„ ํƒํ–ˆ๋‹ค. NestedScrollView๋Š” ์—†์• ๊ณ  ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ๋ทฐ ํ•˜๋‚˜๋กœ ๋‹ค ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ์‹์ด๋‹ค. ๊ฒฐ๊ตญ์—” ๊ธฐ๋Šฅ๊ณผ ํ™”๋ฉด์„ ์ƒˆ๋กœ ๋งŒ๋“œ๋Š” ๊ฒƒ์„ ํƒํ•  ์ˆ˜ ๋ฐ–์— ์—†์—ˆ๋‹ค.๐Ÿฅด๐Ÿ™ƒ

์„ธ ๋ฒˆ์งธ ๋ฐฉ๋ฒ•์„ ํƒํ•˜๋ฉด์„œ ๋‚˜์˜จ ์ด์Šˆ๋“ค์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ•ด๊ฒฐํ–ˆ๋‹ค.

 

1) ์Šคํฌ๋กค ์‹œ ํ™”๋ฉด ๋ฒ„๋ฒ…์ž„ 

> ์ด๊ฒƒ๋„ ์„ฑ๋Šฅ ๋ฌธ์ œ์ด๊ธฐ์— ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ๋ทฐ ์„ฑ๋Šฅ ํ–ฅ์ƒ์„ ์œ„ํ•ด ์ž‘์—…ํ–ˆ๋‹ค.

https://gift123.tistory.com/67

 

์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐœ๋ฐœ (34) RecyclerView ์„ฑ๋Šฅ ํ–ฅ์ƒ

Android ๊ฐœ๋ฐœ์„ ํ•˜๋‹ค๋ณด๋ฉด ๋ถˆ๊ฐ€ํ”ผ ํ•˜๊ฒŒ RecyclerView๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•˜๋Š” ์ˆœ๊ฐ„์ด ๋Œ€๋ถ€๋ถ„ ์˜ต๋‹ˆ๋‹ค. ์š”์ƒˆ Compose์—ดํ’์ด ํœฉ์“ธ๊ณ  ์žˆ์ง€๋งŒ ์•„์ง์€ ํšŒ์‚ฌ์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ชฉ๋กํ˜• UI๋Š” RecyclerView๋ฅผ ํ†ตํ•ด ๋งŒ๋“ค์—ˆ์„ ๊ฒ๋‹ˆ๋‹ค

gift123.tistory.com

 

<Adpater> 

  •  setHasStableIds(true) ์‚ฌ์šฉ
  • fun getItemId(position: Int) : Long ์‚ฌ์šฉ
  •  ListAdapter, DiffUtil ์‚ฌ์šฉ (์›๋ž˜๋ถ€ํ„ฐ ์“ฐ๊ณ  ์žˆ๊ธฐ๋Š” ํ–ˆ๋‹ค.)

<RecyclerView>

  • setHasFixedSize(true) ์‚ฌ์šฉ
  • ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ œ๊ฑฐ : setItemAnimator(null)

<Glide>

  • image size ์กฐ์ ˆ : T override(int size) ์‚ฌ์šฉ
  • ์ด๋ฏธ์ง€ ๋…ธ์ถœ์— fade in ์• ๋‹ˆ๋ฉ”์ด์…˜ ์‚ฌ์šฉ : transition(DrawableTransitionOptions.withCrossFade())

๋“ฑ

 

2) ConcatAdapter์—์„œ ํ•˜๋‚˜์˜ GridLayoutManager๋ฅผ ์“ฐ๋Š” ์ด์Šˆ. Adapter ๋งˆ๋‹ค span count๊ฐ€ ๋‹ฌ๋ผ์•ผ ํ•œ๋‹ค.

GridLayoutManager๊ฐ€ ๋ฆฌ์‚ฌ์ดํด๋Ÿฌ๋ทฐ์˜ ๋ทฐ ์•„์ดํ…œ์˜ ๋ทฐํƒ€์ž… ๋ณ„๋กœ span count๋ฅผ ์ ์šฉํ•˜๋„๋ก ํ•ด์•ผํ•œ๋‹ค. ์ด๊ฒƒ์„ ๊ฐ€๋Šฅํ•˜๋„๋ก ํ•˜๋ ค๋ฉด, ์•„์ดํ…œ์ด ์ฐจ์ง€ํ•˜๋Š” span ๊ฐœ์ˆ˜๋ฅผ ๋ณ€๊ฒฝํ•ด์„œ  span count๊ฐ€ ๋ณ€๊ฒฝ๋œ ๊ฒƒ์ฒ˜๋Ÿผ ๋ณด์ด๊ฒŒ ํ•  ์ˆ˜ ์žˆ๋‹ค. 

์ด ๋ฐฉ๋ฒ•์ด ๋„ค ๋ฒˆ์งธ ๋ฐฉ๋ฒ•(Wrapper Adapter ๋ฐฉ๋ฒ•)๋ณด๋‹ค ๊ณต์ˆ˜๊ฐ€ ๋œ ๋“œ๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ๋ณด์˜€๋‹ค.

 

1. ConcatAdapter ์ƒ์„ฑ ์‹œ Config ๊ฐ’์œผ๋กœ setIsolateViewType(false)๋ฅผ ์„ค์ •ํ•œ๋‹ค.

https://developer.android.com/reference/androidx/recyclerview/widget/ConcatAdapter

 

ConcatAdapter  |  Android Developers

androidx.constraintlayout.core.motion.parse

developer.android.com

 

ConcatAdapter๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ ๋ทฐ๊ฐ€ ๊ฐ๊ฐ์˜ ๋ทฐ ํƒ€์ž…์„ ๊ฐ–๋„๋ก ํ•œ๋‹ค.

 

2. GirdLayoutManager๊ฐ€ ๋ทฐ ํƒ€์ž…์— ๋”ฐ๋ผ Span size๊ฐ€ ๋ณ€๊ฒฝ๋˜๋„๋ก SpanSizeLoopUp์„ ์„ค์ •ํ•ด์ค€๋‹ค. ๊ทธ๋Ÿผ Span count๊ฐ€ ๋ณ€๊ฒฝ๋œ ๊ฒƒ๊ณผ ๊ฐ™์€ ํšจ๊ณผ๊ฐ€ ์žˆ๋‹ค.

 

https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager

 

GridLayoutManager  |  Android Developers

androidx.car.app.managers

developer.android.com

๋ทฐ ํƒ€์ž… ๋ณ„ span size๋ฅผ ์ง€์ •ํ•˜๊ฒŒ ํ•˜๋Š” ํ•ต์‹ฌ์ด๋‹ค.
3์นธ ์ค‘ 3์นธ์„ ์ฐจ์ง€ํ•˜๋ฉด span count๊ฐ€ 1์ด ๋œ ๊ฒƒ์ฒ˜๋Ÿผ ๋ณด์ธ๋‹ค.

3) GirdLayoutManager ์‚ฌ์šฉ ์ „์šฉ RecyclerView์˜ ๋ทฐ ์•„์ดํ…œ ๊ฐ„ space ์˜์—ญ์„ ์ง€์ •ํ•˜๋Š” ์ปค์Šคํ…€ ItemDecoration ์ˆ˜์ •

NestedScrollView๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์ฒซ ๊ธฐ๋Šฅ ๋ฐ ํ™”๋ฉด ๊ตฌํ˜„์„ ํ•˜๋ฉด์„œ, GridLayoutManager๊ฐ€ ์„ค์ •๋œ RecyclerView์˜ ๋ทฐ ์‚ฌ์ด์˜ margin ๊ฐ„๊ฒฉ์„ ๋„ฃ์–ด์ฃผ๋Š” ์ปค์Šคํ…€ Item Decoration์„ ์ž‘์„ฑํ–ˆ๋‹ค. ์‚ฌ์‹ค ๋งค์šฐ ๋ฟŒ๋“ฏํ–ˆ๋‹ค. ์ด ์ •๋„๋ฉด ์‚ฌ์šฉํ•˜๊ธฐ์—๋„ ํŽธํ•˜๊ณ , ์žฌ์‚ฌ์šฉ๊ฐ€๋Šฅํ•œ ์ปค์Šคํ…€ Item Decoration์ด๋ผ ๋‚˜ ์™ธ์—๋„ ์ด ํ”„๋กœ์ ํŠธ๋ฅผ ๋‹ด๋‹นํ•˜๋Š” ๋‹ค๋ฅธ ๊ฐœ๋ฐœ์ž๋“ค์ด ์‚ฌ์šฉํ•  ๊ฒƒ์„ ๊ธฐ๋Œ€ํ–ˆ๋Š”๋ฐ, ConcatAdapter์— ์“ฐ๊ฒŒ ๋˜๋ฉด์„œ ์ˆ˜์ •์ด ํ•„์š”ํ•ด์กŒ๋‹ค. ConcatAdapter์—์„œ ์›ํ•˜๋Š” ๋ทฐ์—๋งŒ space ์ฒ˜๋ฆฌํ•˜๊ธฐ๊ฐ€ ๊นŒ๋‹ค๋กญ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ์•˜๋‹ค. ์›๋ž˜๋Š” ๋ทฐ์™€ ๋ทฐ ์‚ฌ์ด(๋‚ด๋ถ€ ๊ฐ„๊ฒฉ) ๋ฟ๋งŒ์ด ์•„๋‹ˆ๋ผ ๊ฐ€์žฅ์ž๋ฆฌ์— ์œ„์น˜ํ•œ ๋ทฐ๋“ค์˜ ๋ฐ”๊นฅ ๋งˆ์ง„ ๊ฐ’(์™ธ๋ถ€ ๊ฐ„๊ฒฉ)๋„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ConcatAdapter์— ์“ฐ์ด๊ฒŒ ๋˜๋ฉด์„œ, ๋ทฐํƒ€์ž…๊ณผ ๋ทฐ์˜ ์œ„์น˜๋ฅผ ํŒ๋‹จํ•˜๋Š” ์กฐ๊ฑด์ด ๋„ˆ๋ฌด๋‚˜ ๊นŒ๋‹ค๋กœ์›Œ์กŒ๋‹ค. ํ”„๋กœ์ ํŠธ ๊ธฐ๊ฐ„์€ ๋งž์ถฐ์•ผ ๋˜๊ณ , ๋‹ค๋ฅธ ๊ธฐ๋Šฅ๋“ค ๊ฐœ๋ฐœ๋„ ํ•ด์•ผํ•ด์„œ ์ด๊ฒƒ๋งŒ ๋ถ™์žก์„ ์ˆ˜๋Š” ์—†๋Š” ์ƒํ™ฉ์ด๊ณ , ๋‹น์žฅ ์‰ฝ๊ฒŒ ํ•ด๊ฒฐ๋  ๊ฒƒ์ฒ˜๋Ÿผ ๋ณด์ด์ง€๋Š” ์•Š๊ณ . ๋‚ด๋ถ€ ๊ฐ„๊ฒฉ ์ฒ˜๋ฆฌ๋งŒ ํ•˜๊ณ , ์™ธ๋ถ€ ๊ฐ„๊ฒฉ ์ฒ˜๋ฆฌ ๊ธฐ๋Šฅ์€ ๋นผ๋Š” ์ชฝ์œผ๋กœ ํƒ€ํ˜‘ํ–ˆ๋‹ค.๐Ÿ˜”๐Ÿ˜ž๐Ÿ˜Ÿ๐Ÿฅบ

 

https://stackoverflow.com/questions/28531996/android-recyclerview-gridlayoutmanager-column-spacing

 

Android Recyclerview GridLayoutManager column spacing

How do you set the column spacing with a RecyclerView using a GridLayoutManager? Setting the margin/padding inside my layout has no effect.

stackoverflow.com

์ฒ˜์Œ ์ปค์Šคํ…€ item decoration ๊ฐœ๋ฐœ ์‹œ ์ฐธ๊ณ ํ–ˆ์—ˆ๋‹ค.

 

4) RecyclerView ๋ทฐ ์žฌ์‚ฌ์šฉํ•˜๋ฉฐ ๋ฐœ์ƒํ•œ ์ด์Šˆ๋“ค ์ˆ˜์ •

NestedScrollView์—์„œ๋Š” ๋ทฐ ์•„์ดํ…œ๋“ค์„ ์žฌ์‚ฌ์šฉํ•˜์ง€ ์•Š์œผ๋‹ˆ ๋ฌธ์ œ๊ฐ€ ์—†์—ˆ๋Š”๋ฐ, ์ด์ œ๋Š” ๋ทฐ๋ฅผ ์žฌ์‚ฌ์šฉํ•˜๋‹ˆ ํ˜„์žฌ ์ƒํƒœ๊ฐ€ ์•„๋‹ˆ๋ผ ์ด์ „ ์ƒํƒœ์˜ ๋ทฐ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์ด์Šˆ๊ฐ€ ๋‚˜ํƒ€๋‚ฌ๋‹ค. ์ด์ „ ๋ทฐ ์ƒํƒœ๋“ค์„ ์ดˆ๊ธฐํ™”ํ•˜๋Š” ์ฝ”๋“œ๋“ค์„ ๋„ฃ์–ด์คฌ๋‹ค. 

๋ทฐ ์ƒํƒœ๋“ค์„ ์ดˆ๊ธฐํ™”ํ•˜๋ฉด์„œ, Glide๋กœ ๋กœ๋“œํ•œ ์ด๋ฏธ์ง€๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๋Š” ์ฝ”๋“œ๋„ ์ด๋ฒˆ์— ์•Œ๊ฒŒ ๋๋‹ค.

๋กœ๋“œํ•œ ์ด๋ฏธ์ง€ ์ดˆ๊ธฐํ™”