我尝试将alertDialog
主题设置为R.style.Theme_MaterialComponents_Light_Dialog_Alert
虽然可以将我的alertDialog
的内容包装到在华为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
将其内容包装到所有电话上的布局中。
尝试创建自定义对话框样式并以百分比添加宽度和高度。