앱 만들기/안드로이드

안드로이드 스튜디오 보라색 버튼 색상 변경하기

나도 처음이야 2021. 1. 15.

최근에는 BackgroundTint 만 수정해도

버튼 색상이 바뀐다.  관련내용은 하기 내용을 참고드립니다.

감사합니다.

 

https://soo0100.tistory.com/1864

 

안드로이드 버튼 색상 바꾸기

안드로이드 버튼의 기본 색상은 퍼플 입니다. values/themes/themes.xml 정의를 보면 하기 와 같이 퍼플 컬러값이 지정되어 있습니다. colorPrimary 를 바꾸게 되면 기본 버튼의 색상이 바뀌게 되지만, colorP

soo0100.tistory.com

+++

 

최근 안드로이드 스튜디오가 업데이트 되면서

버튼의 기본 색상이 보라색으로 바뀌었다.

그대로 써도 무방하지만 그래도 회색음영의 이전 기본 색상이 더 좋아보였던거 같다.

기본 보라색 버튼 색상을 바꾸어 보자.

 

버튼 위젯 기본 색상 - 보라색

 

Background 색상 값만 바꾸어서는 버튼 색상 값이 바뀌지 않는다.  

BackgroundTint 도 수정을 해야 한다.

필자는 흰색을 적용 했고, 회색 음영의 버튼 값을 없었다.

사실 Tint 라는 개념은 안드로이드 개발자 사이트에서 찾아본 결과,

색상을 섞는 개념이다.  즉, Background 에 이미지나 기본 컬러를 설정하고 그 배경에 Tint 색상을 하기 모드로 설정하여 색상 값을 표현한다는 의미이다.

사실 하기 옵션값을 다 이해하지는 못했다.

android:backgroundTintMode

Blending mode used to apply the background tint.

Must be one of the following constant values.

ConstantValueDescription

add 10 Combines the tint and drawable color and alpha channels, clamping the result to valid color values. Saturate(S + D)
multiply e Multiplies the color and alpha channels of the drawable with those of the tint. [Sa * Da, Sc * Dc]
screen f [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc]
src_atop 9 The tint is drawn above the drawable, but with the drawable?s alpha channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc]
src_in 5 The tint is masked by the alpha channel of the drawable. The drawable?s color channels are thrown out. [Sa * Da, Sc * Da]
src_over 3 The tint is drawn on top of the drawable. [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc]

 

하지만, 백그라운드 와 Tint 값을 조정하면 

내가 원하는 색상을 편히 얻을 수 있는 기본 개념만 알고 있다면

큰 문제는 되지 않을 듯 하다. 다만 테스트가 필요할 뿐 ^^

android:background

A drawable to use as the background. This can be either a reference to a full drawable resource (such as a PNG image, 9-patch, XML state list description, etc), or a solid color such as "#ff000000" (black).

May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

android:backgroundTint

Tint to apply to the background.

May be a color value, in the form of "#rgb", "#argb", "#rrggbb", or "#aarrggbb".

 

 

해당 포스팅에서

부연 설명을 주실 분들은 댓글 부탁드립니다.

저도 포스팅 하면서 고치고, 배우고 업데이트 하겠습니다.

안드로이드 스튜디오에서 갑자기

버튼이 보라색이 되었다고 놀라지 마시고 편히 바꾸어 주세요

감사합니다.

반응형

댓글