티스토리 뷰

android

[android] Fragment 모서리 둥글게

tbMaster 2020. 7. 3. 18:01
반응형

Fragment를 다이얼로그처럼 만들기로 했다. 그리고 모서리를 둥글게 적용하기 위해서 레이아웃의 background 에 corner를 작성한 drawable 파일을 넣었는데... 직각이 그대로 표출 @.@!!!

그래서 찾아보니... 레이아웃에 대한 작업 + Fragment 내에서 inflate할 때, 추가 작업을 해야 한단다... 

해보자!! 

 

Fragment 파일 내에 위와 같이 setBackgroundDrawable의 ColorDrawable을 TRANSPARENT 로 투명하게 설정해주면 모서리가 나타나지 않는다. 

 

* 참고로 안드로이드 버전이 4 이하일 경우, Blue Line이 나타난다는데... 그럴경우는 아래 stackoverflow를 참고하자.

https://stackoverflow.com/questions/15421271/custom-fragmentdialog-with-round-corners-and-not-100-screen-width/44912145

 

Custom FragmentDialog with round corners and not 100% screen width

I am creating a custom fragment dialog with round corners and with layout that would not fill the screen width (I would prefer if it just wrapped its content). this is my rounded_dialog.xml in dra...

stackoverflow.com

 

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/07   »
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 31
글 보관함