我想做点像
我已经尝试过渲染脚本来实现这一目标。虽然我无法做到这一点。 我想通过单击编辑按钮在背景视图上获得此模糊效果。 请帮帮我。
答案 0 :(得分:0)
添加gradle依赖
compile 'fr.tvbarthel.blurdialogfragment:lib:2.2.0'
创建自己的对话框
public class SampleDialogFragment extends MyCustomDialogFragment {
/**
* Engine used to blur.
*/
private BlurDialogEngine mBlurEngine;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBlurEngine = new BlurDialogEngine(getActivity());
mBlurEngine.setBlurRadius(8);
mBlurEngine.setDownScaleFactor(8f);
mBlurEngine.debug(true);
mBlurEngine.setBlurActionBar(true);
mBlurEngine.setUseRenderScript(true);
}
@Override
public void onResume() {
super.onResume();
mBlurEngine.onResume(getRetainInstance());
}
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
mBlurEngine.onDismiss();
}
@Override
public void onDestroy() {
super.onDestroy();
mBlurEngine.onDetach();
}
@Override
public void onDestroyView() {
if (getDialog() != null) {
getDialog().setDismissMessage(null);
}
super.onDestroyView();
}
...
}