set width of custom dialog to wrap content android
问题 I want to set the width of custom dialog to wrap content but always it fill all the width of the screen I have tested this android.view.WindowManager.LayoutParams params = mydialog.getWindow().getAttributes(); params.width = android.view.WindowManager.LayoutParams.WRAP_CONTENT; mydialog.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); and that mydialog.getWindow().setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); 回答1: I also having a hard time in