我尝试将alertDialog
主题设置为R.style.Theme_MaterialComponents_Light_Dialog_Alert
虽然可以将alertDialog
的内容包装到在huawei y9(Android Pie)上放大的布局中,但没有将其包装在lenovo api 19上
我尝试将LayoutParams
设置为wrap_content
,但仍然无济于事:
val inflater = LayoutInflater.from(mCtx)
val viewInflater = inflater.inflate(R.layout.popup_menu,null)
val window = AlertDialog.Builder(mCtx,R.style.Theme_MaterialComponents_Light_Dialog_Alert)
.setView(viewInflater)
.setCancelable(false)
alertD = window.create()
//alertD.window?.setLayout(WindowManager.LayoutParams.WRAP_CONTENT,WindowManager.LayoutParams.WRAP_CONTENT)
alertD.show()
因此,我需要AlertDialog
将其内容包装到所有手机上的布局中。