[Android] 색상 리소스 추가

이황근·2024년 2월 12일

Android

목록 보기
3/9

프로젝트를 하다 보면 대표 색상이 있는데 매번 HEX를 이용해서 색상을 추가해주기 불편하다. 그래서 대표적인 Color Resouce를 추가할 수 있는데 그 방법을 알아보려 한다.

values 폴더를 확인하면 colors.xml파일을 확인할 수 있다.

여기에 직접 자기가 HEX를 이용해서 추가하면

<TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/MYRED"
        android:text="TextView" 
 />

이렇게 사용할 수 있다.

profile
낭만 개발자

0개의 댓글