BottomNavigation의 폰트를 변경하는 방법
1. XML 파일에서 BottomNavigationView 세부 설정 수정
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemBackground="@color/purple_500"
app:itemIconTint="@drawable/selector"
-------------수정할 부분--------------------------------------------------------
app:itemTextAppearanceActive="@style/BottomNavigationViewTextStyle"
app:itemTextAppearanceInactive="@style/BottomNavigationViewTextStyle"
-------------------------------------------------------------------------------
app:itemTextColor="@drawable/selector"
app:labelVisibilityMode="labeled"
app:menu="@menu/menu" />
2. rest/values/styles.xml 수정
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="BottomNavigationViewTextStyle">
...
<item name="android:fontFamily">@font/nanumsquareroundeb</item>
...
</style>
</resources>
주의사항: 사용하기 위한 폰트는 미리 다운로드 후 설정해야 함.
res 디렉토리에 font 디렉토리 생성 후, ttf 파일 저장. 그리고 app_font.xml 파일에 설정 필요
<?xml version="1.0" encoding="utf-8"?>
<font-family
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<font
android:font="@font/nanumsquareroundeb"
android:fontStyle="normal"
android:fontWeight="1000"
app:font="@font/nanumsquareroundeb"
app:fontStyle="normal"
app:fontWeight="1000"
tools:targetApi="o" />
</font-family>
| 참고
'개발자 도전기' 카테고리의 다른 글
aws visual studio permission denied (publickey) (0) | 2022.10.11 |
---|---|
미첼 레스닉의 평생유치원 | 평생 학습을 즐거워할 수 있어야 한다 (0) | 2022.10.10 |
루틴의 힘 | 자신의 진전 상황을 일깨워 줄 수 있는 장치 고안 (0) | 2022.10.10 |
아주 작은 습관의 힘 | 나쁜 습관의 신호 단계를 차단한다 (0) | 2022.10.08 |
[안드로이드] D/EGL_emulation: app_time_stats: 없애는 법 (0) | 2022.10.08 |