APP/AndroidStudio
[Android Studio] 버튼 및 레이아웃 그림자 효과주기 Shadow Effect
세얼간이코딩
2020. 7. 19. 09:00
반응형
[Android Studio] 버튼 및 레이아웃 그림자 효과 주기 Shadow Effect
1. shadow.xml 생성
<?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="1dp" android:bottom="2dp" android:left="0dp" /> <corners android:radius="5dp" /> <solid android:color="#00CCCCCC" /> </shape> </item>
<item> <shape> <padding android:top="0dp" android:right="1dp" android:bottom="2dp" android:left= "0dp" /> <corners android:radius="5dp" /> <solid android:color="#10CCCCCC" /> </shape> </item>
<item> <shape> <padding android:top="0dp" android:right="1dp" android:bottom="2dp" android:left="0dp" /> <corners android:radius="5dp" /> <solid android:color="#20CCCCCC" /> </shape> </item>
<item> <shape> <padding android:top="0dp" android:right="1dp" android:bottom="2dp" android:left="0dp" /> <corners android:radius="5dp" /> <solid android:color="#30CCCCCC" /> </shape> </item>
<item> <shape> <padding android:top="0dp" android:right="1dp" android:bottom="2dp" android:left="0dp" /> <corners android:radius="5dp" /> <solid android:color="#50CCCCCC" /> </shape> </item>
<!-- Background -->
<item> <shape> <solid android:color="#ffffff" /> <corners android:radius="0dp" /> </shape> </item>
</layer-list>
2. activity_main.xml 코드 추가
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:background="@drawable/shadow">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="그림자"
android:gravity="center"/>
</LinearLayout>
반응형