AlertDialog上背景模糊的java问题
我试图用这篇文章模糊背景: https://stackoverflow.com/a/21278278/10837992
它的工作很好,但我有一个小问题的大小对话框
我创建了自定义布局:
我改变了方法的实现
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = this.getLayoutInflater(); View dialogView = inflater.inflate(R.layout.alert_dialog_layout, null); builder.setView(dialogView); TextView title = dialogView.findViewById(R.id.Title); TextView desc = dialogView.findViewById(R.id.Desc); title.setText("Title"); desc.setText("Desc"); AlertDialog alert = builder.create(); Bitmap map = new BlurUtils().takeScreenShot(getActivity()); Bitmap fast = new BlurUtils().fastblur(map, 50); final Drawable drawable = new BitmapDrawable(getResources(), fast); alert.getWindow().setBackgroundDrawable(drawable); alert.show();
# 1 楼答案
好的,我找到一个解决方案:
刚刚在AlertDialog中添加了主题。建筑商