Skip to content

Commit

Permalink
#6 feat/메인화면 : MainActivity 에 BottomNavigationView 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
HayleyKim0716 committed Aug 1, 2022
1 parent c3d9647 commit 00d5248
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/gray_800" android:state_checked="true" />
<item android:color="@color/gray_200" android:state_checked="false" />
</selector>
52 changes: 39 additions & 13 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.MainActivity">
tools:context=".ui.main.MainActivity"
>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="이곳은 카카오 로그인 후 넘어온 메인 액티비티입니다."
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<data>
<variable
name="viewModel"
type="com.ftw.hometerview.ui.main.MainViewModel"
/>
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintTop_toTopOf="parent"
/>

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/menu_main_bottom_navigation"
app:itemBackground="@color/white"
app:itemIconTint="@color/selector_main_bottom_navigation_color"
app:itemTextColor="@color/selector_main_bottom_navigation_color"
app:itemIconSize="@dimen/main_bottom_navigation_icon_size"
app:onNavigationItemSelected="@{viewModel::onNavigationItemSelected}"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
/>

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

</androidx.constraintlayout.widget.ConstraintLayout>
23 changes: 23 additions & 0 deletions app/src/main/res/menu/menu_main_bottom_navigation.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/home"
android:enabled="true"
android:icon="@drawable/icon_home"
android:title="@string/main_bottom_navigation_menu_home"
/>
<item android:id="@+id/map"
android:enabled="true"
android:icon="@drawable/icon_map"
android:title="@string/main_bottom_navigation_menu_map"
/>
<item android:id="@+id/heart"
android:enabled="true"
android:icon="@drawable/icon_heart"
android:title="@string/main_bottom_navigation_menu_heart"
/>
<item android:id="@+id/user"
android:enabled="true"
android:icon="@drawable/icon_user"
android:title="@string/main_bottom_navigation_menu_user"
/>
</menu>
1 change: 1 addition & 0 deletions app/src/main/res/values/dimen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@
<!-- loginActivity dp size -->
<dimen name="kakao_login_button_box_bottom_margin">14dp</dimen>

<dimen name="main_bottom_navigation_icon_size">26dp</dimen>
</resources>

0 comments on commit 00d5248

Please sign in to comment.