빈 구멍 채우기
[Android][DialogFragment] Rounded Corner + 너비 값 지정
⭐⭐기록
2023. 8. 9. 20:40
[Android] Custom DialogFragment 좌우 너비 꽉 차게
90% 90% % 조절해서 style에 넣으면 됨. (style 코드 참고) onCreate에 style을 지정해주세요. override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setStyle(STYLE_NORMAL, R.style.ProfileNameEditTextDialogSt
dvlv.tistory.com
https://stackoverflow.com/a/62432311
How to make custom dialog with rounded corners in android
What I am trying to do: I am trying to make a custom dialog in android With rounded corners. What is happening: I am able to make custom dialog but it doesn't have rounded corners. I tried adding a
stackoverflow.com
스타일로 지정
<style name="RoundedCornerDialog" parent="Theme.Material3.DayNight.Dialog">
<item name="dialogCornerRadius">20dp</item> // 코너 radius 값
<item name="android:windowMinWidthMajor">90%</item> // 화면 너비
<item name="android:windowMinWidthMinor">90%</item> // 화면 너비
</style>
DialogFragment에서 onCreateDialog()가 아니라 onCreateView()로 화면 inflate 하기
class SortDialogFragment : DialogFragment() {
//지정한 스타일을 theme으로 설정
override fun getTheme() = R.style.RoundedCornerDialog
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
...
}
...
}