-
[Android] Material Bottom Sheet Corner Round(바텀 시트 모서리 둥글게 만들기)카테고리 없음 2020. 9. 29. 12:24
andorid에서 bottom sheet을 적용시킬 때 좌우상단에 radius를 주고 싶을 때 styles.xml 파일만으로만 간단하게 만들 수 있다.
둥글기를 조절하고 싶을 때는 cornerSizeTopRight, Left 값을 조절해주면 된다. Top뿐만 아니라 Bottom도 조절할 수 있다.
[res] - [values] - styles.xml
<resources> <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> <item name="bottomSheetDialogTheme">@style/CustomBottomSheetDialog</item> </style> <style name="CustomBottomSheetDialog" parent="@style/ThemeOverlay.MaterialComponents.BottomSheetDialog"> <item name="bottomSheetStyle">@style/CustomBottomSheet</item> </style> <style name="CustomBottomSheet" parent="Widget.MaterialComponents.BottomSheet"> <item name="shapeAppearanceOverlay">@style/CustomShapeAppearanceBottomSheetDialog</item> </style> <style name="CustomShapeAppearanceBottomSheetDialog" parent=""> <item name="cornerFamily">rounded</item> <item name="cornerSizeTopRight">@dimen/size16</item> <item name="cornerSizeTopLeft">@dimen/size16</item> <item name="cornerSizeBottomRight">0dp</item> <item name="cornerSizeBottomLeft">0dp</item> </style> </resources>
완성
본 작성자는 안드로이드 개발을 공부하고 있는 학생으로 피드백 및 질문을 환영합니다. 그러나 무단복제 및 배포는 정중하게 사양하고 있으며, 참고 사이트로 링크를 남기실 때는 동의를 구해주시기 바랍니다.
반응형