
1. BottomNavigationView 2. BottomNavigationView + ViewPager2 menu.xml BottomNavigationView bottom_navigation_menu.xml HomeFragment.kt package com.example.bottomnavigationexample import androidx.fragment.app.Fragment class HomeFragment : Fragment(R.layout.fragment_home) FavoritesFragment.kt package com.example.bottomnavigationexample import androidx.fragment.app.Fragment class FavoritesFragment :..

소스 : Activity와 Fragment 간의 ViewModel 공유 처음 앱을 실행하면 Activity가 생성된 후에 Fragment가 생성된다. 화면 회전 시 위처럼 생명주기가 진행된다. 두 번째 페이지로 이동했을 때의 생명주기 다시 회전하면 위와 같은 생명주기를 거친다. onPause() 되어있던 FragmentRed도 생명주기를 거쳐 다시 onStart()로 돌아온다. 잠시 후 FragmentRed가 onResume() 상태가 안되면 완전히 파괴된다. FragmentGreen는 현재 화면이므로 파괴되지 않는다. FragmentGreen은 onPause() 상태가 되고 파괴됐던 FragmentRed는 재생성된다. Fragment Count 가 0이 된 이유는 FragmentRed가 재생성 됐기 때..

+ ViewPager2 + TabLayout build.gradle (Module: app) dependencies { // ViewPager2 implementation 'androidx.viewpager2:viewpager2:1.0.0' // material design (TabLayout) implementation 'com.google.android.material:material:1.1.0' } res/drawable 에 이미지 추가 Drawable Resource File 추가 ic_main_tab_home.xml ic_main_tab_study.xml ic_main_tab_my.xml viewpager_fragment.xml ViewPagerFragmentHome.kt package com...

CoordinatorLayout + ViewPager2 + TabLayout build.gradle (Module: app) dependencies { // material design implementation 'com.google.android.material:material:1.1.0' // ViewPager2 implementation 'androidx.viewpager2:viewpager2:1.0.0' // RecyclerView implementation 'androidx.recyclerview:recyclerview:1.1.0' } styles.xml recyclerview_item.java RecyclerViewAdapter.java package com.jwsoft.javaproject;..

CoordinatorLayout + ViewPager2 + TabLayout build.gradle (Module: app) dependencies { // material design implementation 'com.google.android.material:material:1.1.0' // ViewPager2 implementation 'androidx.viewpager2:viewpager2:1.0.0' // RecyclerView implementation 'androidx.recyclerview:recyclerview:1.1.0' } styles.xml recyclerview_item.xml RecyclerViewAdapter.kt package com.jwsoft.kotlinproject i..
- Total
- Today
- Yesterday
- Architecture Pattern
- 혀가 길지 않은 개발자
- 안드로이드
- handler
- View
- activity
- CoordinatorLayout
- Android
- 코틀린
- Intent
- coroutine
- ViewPager2
- ArrayList
- JSONArray
- 자바
- JSONObject
- DataBinding
- Kotlin
- TabLayout
- James Kim
- Livedata
- java
- 안드로이드 #코틀린 #Android #Kotlin
- recyclerview
- MVVM
- Design Pattern
- XML
- ViewModel
- Vue.js #Vue.js + javascript
- fragment
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |