我已经实现了Django==2.1.5
,但是结果看起来像这样:
代替这个(从XML预览):
片段的onViewCreated
DialogFragment
SuccessDialog类
val button = view.findViewById(R.id.button_register) as Button
button.setOnClickListener{
Log.d(TAG, "Clicked")
val dialog = SuccessDialog()
dialog.show(fragmentManager, "success dialog")
}
对话框的XML:
class SuccessDialog: DialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.dialog_success, container, false)
val button: Button = view.findViewById(R.id.button_ok)
button.setOnClickListener{
dialog.dismiss()
}
return view
}
}
答案 0 :(得分:1)
tools:...
对于 xml预览 是。因此,请使用:
app:srcCompat="..."
代替
tools:srcCompat="..."
要更改尺寸,请在onCreateView
的{{1}}中使用它
SuccessDialog