Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 회원가입 구현 #java
- 리눅스 #우분투 포트포워딩 #리눅스 포트포워딩 #우분투22.04 php apache db #mariadb #mysql
- android #tip #timer #handler #sendmessagedelayed
- react #react 프로젝트 생성 #초보 #쉽게 #react 세팅 #react frontend #리액트 기본구조
- Apache #PHP #마리아DB #아파치
- MySQL #안드로이드 로그인기능 #안드로이드 php 오류 #안드로이드 db #
- procedure does not exist
- hedisql limit 1000
- 부트스트랩 추가시 오류 #
- 안드로이드 타이머 #타이머 #handler timer #android handler timer #countdowntimer
- 안드로이드 #앱 아이콘 #앱 아이콘 커스텀하기 #앱 로고 만들기 #앱 아이콘 만들기 #android logo custom #android icon custom #android logo 만들기 #image asset #
- XAMPP #PHP #mysql #Android #연동
- 안드로이드 앱 아이콘 변경 #안드로이드 앱 아이콘 사이즈 #안드로이드 앱 아이콘 가이드
- MySQL(MariaDB)접속 #MariaDB원격 접속 #콘솔에서mysql접속 #원격지에서MySQL #php안드로이드 연동
- android hedisql #안드로이드 mariaDB #안드로이드 로그인 권한 #안드로이드 로그인
- Module not found: Error: Can't resolve '@popperjs/core'
- 크롤링 #텍스트 크롤링 #파이썬 #구름IDE
- mariadb #mysql
- 안드로이드 로그인 회원가입 기능 #안드로이드 php 로그인 #userValidate.php #android php 중복체그 #안드로이드 회원가입 id 중복체크 기능 #android login id check
- 부트스트랩 #bootstrap install #
- react #리액트 #프로젝트 초기세팅 #초기구현 #클린코드 #cleancode #node #react-node #vite #react 설치 #react 세팅 #쇼핑몰 #eslint 설정 #vite eslint #TailWindCSS란? #테일윈드적용 #TailWindCSS 적용
- mysql #dataloongforcolumn #ER_DATA_TOO_LONG #mariaDB #my.ini찾기 #숨김my.ini찾기 #strict mode 해제 #strict mode
- 안드로이드 아이콘 만들기 #안드로이드 vector asset #android vector asset custom #안드로이드 vector background color change #android pathdata editor #vector drawables edit #vector drawable background color #drawable background color #an
- Android #bottom navigation View #Bottom tab #FRAGMENT #JAVA #Material Design #안드로이드 프래그먼트 바텀 네비게이션 뷰 커스텀 #안드로이드 메뉴 아이콘 커스텀 #안드로이드 메뉴 #프래그먼트 메뉴 #fragment menu i
- hedisql #mariadb #mysql #마리아db #암호화 복호화 #aes512 #aes_encrypt #aes_decrypt #hedisql 펑션 생성 #hedisql 프로시저 생성 #hedisql 매개변수 #db 펑션 매개변수 #db 프로시저 #db 함수 #db return
- php #안드로이드 #로그인&회원가입
- my.ini위치 확인
- 터미널 #terminal #aws 인스턴스 접속
- nodejs #express #게시판 기능 구현
- db 프로시저 권한 부여 #db procedure 권한 부여 #
Archives
- Today
- Total
맨땅에 코딩
[안드로이드]ActionBar, ToolBar, 상태 표시줄 커스텀 본문
목차
반응형
모르시겠으면 그대로 쭉 따라하시면 됩니다
1) ActionBar, ToolBar 커스텀
1. 우선 원래 있던 ActionBar를 지워줍니다
themes.xml에서
<style name="Theme.ParkingSensor" parent="Theme.AppCompat.Light.NoActionBar">
로 style을 변경해줍니다
어두운 테마를 원하시면 Light 대신 Dark를 써주시면 됩니다
2. layout에 toolbar.xml을 만들어줍니다
[toolbar.xml]
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/Pink"
android:minHeight="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="주차상태 View"
android:layout_gravity="center"
android:id="@+id/toolbar_title"
android:textSize="22sp"
/>
</androidx.appcompat.widget.Toolbar>
위 소스코드에 대한 Design입니다
android:background에서 @color에 컨트롤+왼쪽마우스 클릭 하시거나 colors.xml에 들어가주셔서
원하시는 색상 코드를 입력해줍니다
<color name="Pink">#FDB9C5</color>
3. toolbar를 사용하는 layout에 오셔서 include해줍니다
저는 activity_main.xml에 추가해주었습니다
<include
android:id="@+id/include"
layout="@layout/toolbar" />
이 코드를 추가해주시면 됩니다
[activity_main.xml]
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".MainActivity"
>
<include
android:id="@+id/include"
layout="@layout/toolbar" />
<LinearLayout
android:layout_width="388dp"
android:layout_height="573dp"
android:orientation="vertical"
이해를 돕기위해 소스코드 일부를 추가합니다
4.MainActiviy.java에 필요한 소스코드를 추가해줍니다(이제 끝입니다)
[MainActivity.java]
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
onCreate에 이 소스코드를 추가해줍니다
어디에 써야될지 헷갈리신다면
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
이 하단에 추가해주시면 됩니다
2) 상대표시줄 커스텀
맨 처음 대표사진의 상태표시줄을 회색으로 바꿔주는 기능입니다
맨 처음 AndroidStudio에서 앱을 런타임 해보시면 상태표시줄이 파란색으로 뜨는걸 확인하실수 있습니다
AndroidManifest.xml에 theme를 아래와 같이 변경해주면 됩니다
[AndroidManifest.xml]
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
반응형
'앱 개발 > Java' 카테고리의 다른 글
[안드로이드] fragment 창 생성 + bottom navigation bar 커스텀 + 메뉴 아이콘 커스텀(저작권 상관X) (0) | 2022.08.10 |
---|---|
[android] Toolbar menu 사용하기(왼쪽, 오른쪽 다) + menu icon 커스텀 (0) | 2022.07.27 |
안드로이드 연결된 wifi ssid 정보 얻기 (0) | 2022.07.15 |
안드로이드 토글 버튼 on/off (아이폰 스타일) (1) | 2022.06.07 |
안드로이드 레이아웃 백그라운드 배경색 설정(벡터 드로어블 이용) (0) | 2022.04.05 |