Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- View
- 코틀린
- AppBarLayout
- Navigation
- DataBinding
- BOJ
- HTTP
- 안드로이드
- CustomView
- room
- sqlite
- CoordinatorLayout
- 알림
- Behavior
- notification
- activity
- onMeasure
- LiveData
- kotlin
- 알고리즘
- onLayout
- CollapsingToolbarLayout
- hilt
- recyclerview
- Coroutine
- lifecycle
- ViewModel
- Android
- 백준
- Algorithm
Archives
- Today
- Total
개발일지
삽질 - Android CoordinatorLayout Floating Action Button 본문
CoordinatorLayout은 View의 Visible상태가 GONE인 것은 생략하기 때문에 FloatingActionButton을 그냥 hide로 숨기면 그 다음부터 상태전달을 생략한다. (hide는 View의 Visible을 GONE으로 만들기 때문)
=> hide에 재정의한 리스너를 달아주자!!
override fun onNestedScroll(coordinatorLayout: CoordinatorLayout, child: FloatingActionButton, target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, type: Int, consumed: IntArray) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type, consumed)
if (dyConsumed > 0) {
child.hide(object : OnVisibilityChangedListener() {
override fun onHidden(fab: FloatingActionButton) {
super.onHidden(fab)
fab.visibility = View.INVISIBLE
}
})
} else if (dyConsumed < 0) {
child.show()
}
}
'삽질' 카테고리의 다른 글
삽질 - StaggeredGridLayoutManager Margin (0) | 2021.01.20 |
---|---|
삽질 - SQLite Add Foreign Key (0) | 2021.01.18 |
삽질 - CoordinatorLayout RecyclerView (0) | 2020.12.09 |
삽질 - Android CollapsingToolbarLayout Title (0) | 2020.12.09 |
삽질 - Android Scroll View Child View match_parent (0) | 2020.12.04 |
Comments