Conversation
kimdoyeon1234
left a comment
There was a problem hiding this comment.
과제하시느라 정말 수고하셨습니다! 전체적으로 깔끔하게 구현해주셔서 보기가 편했습니다 ! color랑 string도 잘 분리해주셔서 좋았어요! 지금도 제대로 동작하지만 수정하면 좋을 부분 살짝 남겼으니 확인해주세요!
| <LinearLayout | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:orientation="horizontal"> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginEnd="20dp" | ||
| android:text="@string/purchase_all" | ||
| android:textColor="@android:color/black" | ||
| android:textSize="18sp" | ||
| android:textStyle="bold" /> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginEnd="20dp" | ||
| android:text="@string/purchase_tops_tshirts" | ||
| android:textColor="@android:color/darker_gray" | ||
| android:textSize="18sp" /> | ||
|
|
||
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="@string/purchase_shoes" | ||
| android:textColor="@android:color/darker_gray" | ||
| android:textSize="18sp" /> | ||
| </LinearLayout> |
There was a problem hiding this comment.
구매하기 화면 상단의 탭 메뉴를 TextView와 View를 조합해서 직접 만들어주셨네요! UI 구조를 잘 짜셔서 모양이 아주 예쁘게 잘 나왔어요!
다만, 나중에 탭을 클릭했을 때 검은색 밑줄이 이동하는 애니메이션을 넣거나 다른 화면으로 부드럽게 넘기려면 직접 코딩하기가 꽤 까다로울 수 있어요. 안드로이드에서 기본으로 제공하는 TabLayout 이라는 기능을 사용해 보시면, 이런 탭 UI를 훨씬 쉽고 유연하게 만드실 수 있을 거예요!
There was a problem hiding this comment.
Tab레이아웃으로 변경했습니다! 피드백 감사합니다!!
| private fun initBottomNavigation() { | ||
| // 앱 실행 시 첫 화면 설정 (HomeFragment) | ||
| if (supportFragmentManager.findFragmentById(R.id.main_frame) == null) { | ||
| replaceFragment(HomeFragment()) | ||
| } | ||
|
|
||
| binding.bottomNav.setOnItemSelectedListener { item -> | ||
| when (item.itemId) { | ||
| R.id.nav_home -> { | ||
| replaceFragment(HomeFragment()) | ||
| true | ||
| } | ||
| R.id.nav_purchase -> { | ||
| replaceFragment(PurchaseFragment()) | ||
| true | ||
| } | ||
| R.id.nav_wishlist -> { | ||
| replaceFragment(WishlistFragment()) | ||
| true | ||
| } | ||
| R.id.nav_cart -> { | ||
| replaceFragment(CartFragment()) | ||
| true | ||
| } | ||
| R.id.nav_profile -> { | ||
| replaceFragment(ProfileFragment()) | ||
| true | ||
| } | ||
| else -> false | ||
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
지금은 탭을 누를 때마다 replaceFragment(HomeFragment())처럼 매번 프래그먼트 객체를 새로 생성하고 있어서, 탭을 왔다 갔다 하면 스크롤이나 입력해 둔 데이터가 싹 초기화되는 현상이 발생합니다.
지금은 단순 ui구현이니 상관없지만 나중에 이 부분을 고치실 때, Jetpack Navigation Component를 도입하는 방식을 적용해 보시면 기존 데이터가 날아가지 않는 훨씬 부드러운 앱을 만드실 수 있을 거예요!
There was a problem hiding this comment.
Jetpack Navigation Component 도입했습니다! 피드백 감사합니다!!
|
수고하셨습니다~ |
📌 2주차 미션_제로
🔗 관련 이슈
Closes #13
✨ 변경 사항
🔍 테스트
📸 스크린샷 (선택)
🚨 추가 이슈