.gitIgnore
먼저 Git에 commit하면서 개발을 진행하려고 하기에 gitIgnore도 관리해야 한다. Flutter로 version control을 할 때에도 쓸 떼 없는 local file들이 공유되어서 굉장히 귀찮았던 경험이 있다. 그래서 이번에는 처음 commit을 하기 전에 recommend되는 gitignore를 찾아서 붙여넣었다.
자세한 내용은 아래서 확인하면 된다.
First commit Android Studio Project -- What should leave out?
I am doing my initial commit for a new android project. I am happy with the state of the code but was wondering about which files to add + commit and which files should I leave out. Here is my .
stackoverflow.com
Theme
단순히 앱의 기능을 개발하는 것을 넘어서 app을 디자인하려고 한다면 theme과 style을 조정해야 할 필요가 있다. 일단, theme에서는 primary color나 secondary color를 설정할 수 있다. style에서는 option 같은 것들을 저장해서 나중에 쓸 수 있게 하는 것 같다. style과 theme의 차이는 theme은 app 전체에서 적용되게 하는 것이고 style은 부분적으로 어떤 view에 적용되게 하는 것이다.
style과 theme에 대해서는 아래서 자세히 볼 수 있다.
https://developer.android.com/develop/ui/views/theming/themes
themes.xml 파일을 보게 되면 이런 식으로 구성이 되어 있다. 기본적으로 android studio에서 세팅되어 있는 값들은 보라색인데 난 카톡 다크모드를 따라할려고 하기 때문에 black을 기반으로 했다. 그리고 여기서 생소하게 등장하는 OnPrimary나 PrimaryVariant는 아래에서 용어를 확인할 수 있다.
https://m2.material.io/design/color/the-color-system.html#color-theme-creation
BottomNavigationView
이건 조금 어려웠다. 왜냐면 난 지금ㅋㅋㅋ기본적인 앱들만 만들어봤는데 갑자기 복잡한 view들이 등장해서 당황했다. 하지만, 전공 때부터 몰라도 일단 구현해보는 습관이 있었기 때문에 일단 구현하고 이해할려고 했다.
https://4z7l.github.io/2020/07/09/bottomnavigationbar.html
[Android Java] BottomnNavigationView를 사용하여 하단 바 생성하기 - HERSTORY
미리보기 개요 많은 애플리케이션에서 많이 보이는 Material Design 중 하나가 Bottom Navigation이다. BottomNavigationView는 하단에 바 형태의 메뉴를 생성하여 사용자에게 인터페이스(UI)를 제공한다. 하단
4z7l.github.io
해당 블로그에 보면 굉장히 bottomNavigationView의 구현에 대해서 잘 설명하고 있다. 그런데 여기서 문제는 deprecated된 부분들이 있다는 것이다. 해당 오류에 대해서 설명해주는 블로그도 있다.
https://junyoung-developer.tistory.com/153
[Android] setOnNavigationItemSelectedListener deprecated 해결
인스타그램 클론 코딩을 하는 도중, BottomNavigation을 만들면서 만난 issue입니다. BottomNavigation의 리스너인 setOnNavigationItemSelectedListener를 이용하여 select 이벤트를 완성하려고 했는데, 이번에 업데이
junyoung-developer.tistory.com
그리고 내가 부가적으로 icon을 클릭했을 때에 다른 아이콘으로 바꾸고 싶었다. 그런데 위에 있는 bottomNavigationView 예시에서 클릭하면 color가 바뀌는 것을 활용해서 icon도 바꿀려고 selector 안에 icon을 바꾸는 code를 넣었는데 제대로 동작하지 않고 아래와 같은 오류가 나왔다.
자세히 읽어보니 역시나 selector로 바꾼 icon 쪽에서 문제가 발생하고 있는 것이었다.
그래서 stack over flow에 찾아봤다.
Android: Bottom Navigation View - change icon of selected item
I have added BottomNavigationView in my application like. main.xml <android.support.design.widget.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="
stackoverflow.com
보다보니 내가 구현한 방법과 동일해서 왜 오류가 났는지 더 모르겠었다. 그런데 자세히 보니
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/child" android:state_checked="false"/>
<item android:drawable="@drawable/child_fill" android:state_checked="true"/>
</selector>
내가 drawable= 대신에 icon=을 쓰고 있었다. 그래서 그걸 바꾸자마자 정상적으로 앱이 빌드되었다.
여기까지 완성!
'안드로이드 앱개발' 카테고리의 다른 글
[SimpleChatApp] 3일차 (0) | 2023.03.20 |
---|---|
[SimpleChatApp] 2일차 (0) | 2023.03.17 |
[SimpleChatApp] 0일차 (0) | 2023.03.16 |
Kotlin 1일차 (0) | 2022.06.23 |
Kotlin 도전기 (0) | 2022.06.23 |