티스토리 뷰


<클릭시 원본>



1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0" encoding = "utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_wdith="match_parent">
    <gradient
        android:angle=""
        android:type="linear"
        android:startColor=""
        android:centerColor=""
        android:endColor=""/>
</shape>
 
cs

1. drawable 폴더에 bg.xml생성

2. 위의 코드를 작성

3.    angle = 각도 (45의 배수만 들어가는 듯함)

startColor, centerColor, endColor = 시작,중간, 끝 색상 (중간색상은 생략 가능)

4. 그라디언트 배경을 사용할 뷰에서

1
2
android:background="@drawable/bg"
 
cs

속성을 적는다.


이미지를 때려박는 방식보다 이 방식이 더 빠르고 좋다고 하니 애용하도록 하자.

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
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
글 보관함