일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Behavior
- LiveData
- room
- BOJ
- Coroutine
- HTTP
- notification
- onMeasure
- 백준
- DataBinding
- 코틀린
- Navigation
- lifecycle
- Android
- 알림
- sqlite
- activity
- CollapsingToolbarLayout
- ViewModel
- recyclerview
- CoordinatorLayout
- 알고리즘
- Algorithm
- kotlin
- AppBarLayout
- CustomView
- hilt
- onLayout
- 안드로이드
- View
- Today
- Total
목록StaggeredGridLayoutManager (2)
개발일지
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/tTrB0/btqUcAmHMn5/wPPELFOZ8IKCTtADK2uYCK/img.png)
StaggeredGridLayoutManager를 이용한 RecyclerView에서 ViewHolder에 Margin을 설정하면 배치가 이상해지는 오류가 발생했다. => gapStrategy를 설정하자 with(binding.recyclerView) { adapter = MovieAdapter() addItemDecoration(GridSpacingItemDecoration(2, 5.toDp())) layoutManager = StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL).apply { gapStrategy = StaggeredGridLayoutManager.GAP_HANDLING_NONE } }
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bh5qBT/btqS9ZUCtVy/uuxPptwbNrMLJ5ZSuKtBtk/img.png)
Layout Manager RecyclerView에 Layout을 관리하는 클래스이다. 종류 LinearLayoutManager : 수평, 수직으로 ViewHolder를 표현한다. GridLayoutManager : 격자판 형식으로 ViewHolder를 표현한다. StaggeredGridLayoutManager : 높이가 불규칙한 격자판 형식으로 ViewHolder를 표현한다. FlexBoxLayoutManager : 반응형으로 ViewHolder를 표현한다. LinearLayoutManager Programming recyclerview.layoutManager = LinearLayoutManager(context) // 수직 recyclerview.layoutManager = LinearLayoutM..