RES->drawable->마오->new->drawable resource file 생성
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#4CAF50"
android:centerColor="#CD1F1F"
android:endColor="#1E37C6"
android:angle="90"
android:centerY="0.5"/>
<corners android:radius="10dp"></corners>
</shape>
-angle-
0도: 좌에서 우로
90도 : 아래에서 위로
180도: 우에서 좌로
270도: 위에서 아래로
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/finger_pressed"/>
<item android:drawable="@drawable/finger"/>
</selector
<item android:state_pressed="true"
android:drawable="@drawable/finger_pressed"/>
눌렀을 때 pressed 이미지 출력
<item android:drawable="@drawable/finger"/>
아닐 때 그냥 finger 출력
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:width="200dp" android:height="120dp"/>
<stroke android:width="1dp" android:color="#0000ff"/>
<solid android:color="#00ff00"/>
<padding android:bottom="1dp"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<size android:width="200dp" android:height="100dp"/>
<stroke android:width="1dp" android:color="#FF0157"/>
<solid android:color="#ffffff"/>
</shape>
</item>
<item android:top="2dp" android:bottom="2dp"
android:right="2dp" android:left="2dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#00ff00"/>
</shape>
</item>
<item android:top="4dp" android:bottom="4dp"
android:right="4dp" android:left="4dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#0000ff"/>
</shape>
</item>
</layer-list>
'For developer > Android' 카테고리의 다른 글
(Android)공모전 앱 제작(~ing) (0) | 2020.05.17 |
---|---|
(Android)inflate (0) | 2020.05.15 |
(Android)setImageResource,src변경 (0) | 2020.05.14 |
(Android)FrameLayOut 버튼클릭 화면바꾸기 (0) | 2020.05.13 |
( Android)엑티비티 끝내기 (finish()) (0) | 2020.05.12 |