[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? {
...
}
...
}
'빈 구멍 채우기' 카테고리의 다른 글
[프로그래머의 뇌] 변수 역할 (0) | 2023.09.03 |
---|---|
[Android Studio][Gradle] keystore.properties (No such file or directory) 로그 - 예제 프로젝트 확인용 (0) | 2023.08.24 |
[Android][TextView] 줄 높이. lineHeight, lineSpacingExtra, lineSpacingMultiplier (0) | 2023.07.20 |
[Android] RecyclerView 하단 패딩에 "android:clipToPadding" (0) | 2023.07.20 |
[GIT] 깃 플로우: git-flow & github-flow & gitlab-flow (0) | 2023.06.26 |