ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Dialog Fragment round corners
    Android 2020. 9. 2. 18:46
    반응형

    Layout

    <androidx.constraintlayout.widget.ConstraintLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/dialog_round_corners"
            >
            ...
            <!-- 추가로 넣고 싶은 요소들 -->
            ...
    </androidx.constraintlayout.widget.ConstraintLayout>

    drawable/dialog_round_corners

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <solid android:color="@android:color/white" />
        <corners android:radius="20dp" />
    </shape>

    dialogFragment

    class CustomDialog : DialogFragment() {
    
        override fun onCreateView(
            inflater: LayoutInflater,
            container: ViewGroup?,
            savedInstanceState: Bundle?
        ): View? {
            val view = inflater.inflate(R.layout.dialog_detail_info, container,false)
            dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
            dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
    
            ...
    
            return view
        }
    
    }
    반응형

    'Android' 카테고리의 다른 글

    [Android] Task  (0) 2020.09.02
    Koin 입문기  (0) 2020.09.02
    Android key hash 구하기  (1) 2020.09.02
    Permission 요청하기 ( api 23 이상)  (0) 2020.09.02
    File read and write  (0) 2020.09.02

    댓글

Designed by Tistory.