Android

[Android] RecyclerView ์—ญ์ˆœ์œผ๋กœ ๋ฐฐ์น˜ / LayoutManager ์†์„ฑ (kotlin)

Forest Yun 2021. 6. 18. 18:12
728x90

โ€‹

LayoutManager ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ RecyclerView ์˜ ์†์„ฑ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

โ€‹

โ€‹

LayoutManager Properties

orientation ๋ฐฉํ–ฅ
ex) vertical, horizontal
reverseLayout ๋ฐฉํ–ฅ์ด ์—ญ์œผ๋กœ ๋ฐ”๋€๋‹ค.
spanCount โ€‹
stackFromEnd ์•„์ดํ…œ ์ถ”๊ฐ€ ์‹œ ์Šคํฌ๋กค์„ ๋งจ ๋์— ์œ ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค.
ex) ์ฑ„ํŒ…

โ€‹

โ€‹

RecyclerView ์—ญ์ˆœ์œผ๋กœ ๋ฐฐ์น˜ํ•˜๊ณ ์ž ํ•  ๋•Œ,

โ€‹

์ฝ”ํ‹€๋ฆฐ ์ฝ”๋“œ๋กœ ์ž‘์„ฑ ์‹œ

val layoutManager:LinearLayoutManager =LinearLayoutManager(this) 
layoutManager.apply { 
			reverseLayout = true 
			stackFromEnd = true 
                    }

 

xml ํŒŒ์ผ์— ์ž‘์„ฑ ์‹œ

<androidx.recyclerview.widget.RecyclerView
	~ 
	app:stackFromEnd="true" app:reverseLayout="true" 
	app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />

โ€‹

โ€‹

โ€‹

โ€‹

โ€‹

โ€‹

โ€‹

<๊ณต๋ถ€ ์ž๋ฃŒ>

https://gdtbgl93.tistory.com/12

๋ฆฌ์‹ธ์ดํฌ๋Ÿฌ๋ทฐ ์—ญ๋ฐฉํ–ฅ

https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutManager.Properties

android developer

https://battleshippark.wordpress.com/2016/09/20/recyclerview-and-scroll/

์ž์„ธํ•œ ์„ค๋ช…

728x90