공부방/Android
Android frament hide and Show changed detect(안드로이드 fragment hide show 변화 감지)
soycrab
2020. 2. 9. 18:44
여러 Fragment 를 관리해야 할때
재사용을 위해 hide 와 show 로 관리를 할때가 있다.
이때 특정 Fragment의 visible 여부에 따라
특정 액션을 하고 싶다면
Fragment에 아래와 같이 override 해서 사용하면
override fun onHiddenChanged(hidden: Boolean) {
super.onHiddenChanged(hidden)
if (hidden) {
} else {
}
}
쉽게 알수 있다.
반응형