drawable폴더 > seekbar_seekbar1.xml

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
<?xml version="1.0" encoding="utf-8"?>
 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!--시크바 배경-->
    <item android:id="@android:id/background">
        <shape android:shape="line">    <!--선 : 길이6dp -->
            <stroke android:width="6dp" android:color="#D5D5D5" />
        </shape>
    </item>
 
    <!-- 시크바 배경2 -->
    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape android:shape="line">
                <stroke android:width="6dp" android:color="#B2CCFF" />
            </shape>
        </clip>
    </item>
 
    <!-- 시크바 프로그래스 -->
    <item android:id="@android:id/progress" >
        <clip>
            <shape android:shape="line">
                <stroke android:width="6dp" android:color="#6799FF" />
            </shape>
        </clip>
    </item>
 
</layer-list>
 
cs
shape타입이 line이어야 thumb부분이 더 크게 보일 수 있다.



drawable폴더 > seekbar_seekbar1_thumb.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="utf-8"?>
<!-- 원모양의 시크바 컨트롤러 -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval"
    android:useLevel="false"  >
    <!-- 배경 -->
    <solid
        android:color="#D9E5FF"/>
    <!-- 테두리 -->
    <stroke
        android:width="2dp"
        android:color="#0054FF" />
    <!-- 크기 -->
    <size
        android:width="13dp"
        android:height="13dp"/>
</shape>
 
cs


activity_main.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
    <LinearLayout
        android:paddingBottom="8dp"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <!-- 시크바 -->
        <SeekBar
            android:progress="5"
            android:max="10"
            android:thumb="@drawable/seekbar_seekbar1_thumb"
            android:progressDrawable="@drawable/seekbar_seekbar1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
        <!--// 시크바 -->
    </LinearLayout>
 
cs



결과


+ Recent posts