我有2个相同的全屏对话框类(对话框A和B),它们从DialogFragment(支持库1)扩展而来,它们在具有 APIs 24 + 的设备上运行时看起来都与预期的一样。 对话框的实现方式不同。
对话框A-覆盖onCreateDialog
,其高度在 API 23 <=
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val inflater = requireActivity().layoutInflater
val view = inflater.inflate(R.layout.fragment_cropped_dialog, null)
// Setting data to views
val builder = AlertDialog.Builder(activity)
builder.setView(view)
val dialog = builder.create()
return dialog
}
对话框B-覆盖onCreateView
,无论使用什么API,它都会全屏显示
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_not_cropped_dialog, container, false)
// Setting data to views
val builder = AlertDialog.Builder(activity)
builder.setView(view)
val dialog = builder.create()
return view
}
问题:对话框A在API 23及更低版本上裁剪的原因是什么?