반응형
1. 그라데이션
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:centerY="0.5"
android:endColor="#B3000000"
android:centerColor="@color/white"
android:startColor="#B3000000"
android:type="linear" />
<corners android:radius="2dp" />
</shape>
2. 그라데이션을 stroke로 주기
그라데이션 설정 후 내부를 색으로 채움
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/subColor100">
<item>
<layer-list>
<!-- Outer shape with gradient -->
<item>
<shape android:shape="rectangle">
<corners android:radius="16dp"/>
<gradient
android:type="linear"
android:angle="45"
android:startColor="@color/mainColor"
android:centerColor="@color/white"
android:endColor="@color/mainColor"
android:centerX="0.5"
android:centerY="0.5"
android:gradientRadius="0.8"/>
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="16dp"/>
<gradient
android:type="linear"
android:angle="225"
android:startColor="@color/mainColor"
android:centerColor="@color/thirdWhiteColor"
android:endColor="@color/mainColor"
android:centerX="0.5"
android:centerY="0.5"
android:gradientRadius="0.8"/>
</shape>
</item>
<!-- Inner shape with solid color -->
<item android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="@color/mainColor"/>
<corners android:radius="16dp"/>
</shape>
</item>
</layer-list>
</item>
</ripple>
4. shape으로 하단에 그림자가 채워지게 하기
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Drop Shadow Stack -->
<item> <shape> <padding android:top="0dp" android:right="0dp" android:bottom="3dp" android:left="0dp" /> <solid android:color="#00CCCCCC" /> </shape> </item>
<item> <shape> <padding android:top="0dp" android:right="0dp" android:bottom="3dp" android:left= "0dp" /> <solid android:color="#10CCCCCC" /> </shape> </item>
<item> <shape> <padding android:top="0dp" android:right="0dp" android:bottom="2dp" android:left="0dp" /> <solid android:color="#20CCCCCC" /> </shape> </item>
<item> <shape> <padding android:top="0dp" android:right="0dp" android:bottom="1dp" android:left="0dp" /> <solid android:color="#30CCCCCC" /> </shape> </item>
<item> <shape> <padding android:top="0dp" android:right="0dp" android:bottom="1dp" android:left="0dp" /> <solid android:color="#50CCCCCC" /> </shape> </item>
<!-- Background -->
<item> <shape> <solid android:color="@color/white" /> </shape> </item>
</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90"
android:pivotX="50%"
android:pivotY="50%"
android:drawable="@drawable/line_dash_horizontal" />
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="@color/subColor200"
android:width="1dp"
android:dashWidth="4dp"
android:dashGap="4dp"/>
</shape>
반응형
'개발 > android_kotlin' 카테고리의 다른 글
[ Kotlin ] Compose - 레이아웃만들기(material icon과 modifier 등) (0) | 2024.11.13 |
---|---|
[ Kotlin ] 라이브러리 의존성 문제 (구버전들) (1) | 2024.11.12 |
[ Kotlin ] 뱃지 읽음 감지 / 최초 실행 접근 (0) | 2024.11.10 |
[ Kotlin ] 안드로이드 바차트 MPAndroidchart BarChart Round Shape (0) | 2024.10.12 |
[ Kotlin ] elevation이 -1인 토글그룹버튼 만들기 ( UI / UX 개선 ) (0) | 2024.09.15 |