-
Notifications
You must be signed in to change notification settings - Fork 5
5.9. 마이페이지
Seulgi Kim edited this page Jan 15, 2021
·
2 revisions
(1) ViewPager를 이용해 기록키워드
, 키워드목록
을 보여줌
(2) BottomSheetDialogFragment를 커스텀하여 보여줌
- MyPageFragment.kt
private fun initViewPager() {
val tabLabel = listOf("기록키워드", "키워드 목록")
val myPageKeywordAdapter = ViewPagerAdapter(this)
myPageKeywordAdapter.fragmentList = listOf(MyPageCurrentKeywordFragment(), MyPageKeywordListFragment())
binding.vpMypage.adapter = myPageKeywordAdapter
TabLayoutMediator(binding.tbMypage, binding.vpMypage){tab, position->
tab.text = tabLabel[position]
}.attach()
binding.vpMypage.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
super.onPageSelected(position)
}
})
}
- MyPageKeywordListFragment.kt
//클릭 시 BottomSheetDialog를 보여줌
myPageKeywordListAdapter.setClickListener {
MyPageBottomSheetDialog().show(childFragmentManager, "keyword")
}
- MyPageBottomSheetDialog.kt
class MyPageBottomSheetDialog : BottomSheetDialogFragment() {
private lateinit var binding: LayoutModalBottomSheetMyPageBinding
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = LayoutModalBottomSheetMyPageBinding.inflate(inflater, container, false)
...
binding.llCancle.setOnClickListener {
dismiss()
}
return binding.root
}
}
마이페이지 - 기록키워드 | 마이페이지 - 키워드목록 | BottomSheetDialog 커스텀 |
---|---|---|