Android

[Android/View Widget] 커스텀 툴바 Customize Tool bar 설정하기

nanee_ 2022. 2. 23. 23:30
728x90
반응형
SMALL

layout xml 파일 생성

layout 폴더에 xml 파일을 하나 생성해 준다.

 

<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/purple_200">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:gravity="left|center_vertical"
        android:orientation="horizontal">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_baseline_toys_24" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            android:text="My Tool bar"
            android:textColor="@color/black"
            android:textSize="20sp"
            android:textStyle="bold" />

    </LinearLayout>

</androidx.appcompat.widget.Toolbar>

 

 

 

include 설정

<include
    layout="@layout/tool_bar"/>

 

 

설정 완료

 

 

 

728x90
반응형
LIST