728x90
우선 actionbar를 사용하지않고 toolbar를 이용할 것이기때문에 manifest에서 테마를 수정해줍시다.
Manifest.xml
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
그리고 툴바를 만들어주고 . . .
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="#FAEBEF"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.appcompat.widget.Toolbar
app:titleTextColor="#FAEBEF"
android:background="#333D79"
android:id="@+id/my_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
tools:ignore="MissingConstraints" />
</LinearLayout>
만들어준 툴바를 앱바로 적용시켜주면 끝...!
MainActivity.kt
setSupportActionBar(findViewById(R.id.my_toolbar))
developer.android.com/training/appbar/setting-up
앱 바 설정하기 | Android 개발자 | Android Developers
가장 기본적인 형태의 작업 모음은 한쪽에는 활동 제목을 표시하고 다른 쪽에는 더보기 메뉴를 표시합니다. 앱 바는 이렇게 간단한 형태로도 유용한 정보를 사용자에게 제공하고 일관된 디자인
developer.android.com
안드로이드 툴바 기본 사용법. (Android Toolbar)
1. 안드로이드 툴바(Toolbar)와 앱바(App Bar) 툴바(Toolbar)는 안드로이드 5.0 (API Level 21)부터 추가된 위젯(Widget)으로, 앱에서 가장 중요한 액션 또는 가장 자주 사용되는 액션들을 제공하는 앱바(AppBar)..
recipes4dev.tistory.com
728x90
'안드로이드' 카테고리의 다른 글
[android][kotlin] ViewFlipper 사용하기 (0) | 2021.05.18 |
---|---|
[android][kotlin] 달력, 시계, 타이머 사용하기 (0) | 2021.05.10 |
[android][kotlin] 카메라 권한 얻어 사용하기 (3) | 2021.02.24 |
[android][kotlin] Json과 RecyclerView (0) | 2021.02.17 |
[android][xml] TabLayout bottom에 위치시키기 (0) | 2021.02.07 |
댓글