Drawable xml을 아래와 같이 정의하여 Gradient Background를 정의할 수 있다.
gradient의 속성 값들에 대한 설명은 아래와 같다.- type : linear(기본값), radial, sweep
- angle : gradient의 기준 방향을 나타내며 원하는 각도를 정의함.
- endColor : gradient의 끝 색상
- centerColor : gradient의 중간 색상
- startColor : gradient의 시작 색상
- gradientRadius : gradient의 반지름 값. type이 'radial'인 경우에만 적용 가능.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<gradient
android:type="linear"
android:angle="90"
android:endColor="#004C4E"
android:centerColor="#103B5E"
android:startColor="#220044" />
</shape>
</item>
</layer-list>
'Android' 카테고리의 다른 글
[Android] JitPack 안드로이드 라이브러리 모듈 배포하기 (0) | 2021.12.30 |
---|---|
[Android] 안드로이드 스튜디오 GradleView Tasks 미노출시 (0) | 2021.12.28 |
[Android] RecyclerView DiffUtil (0) | 2021.12.01 |
[Android] Context (0) | 2021.09.01 |
[Android] Serializable과 Parcelable (0) | 2021.08.05 |