在此先感谢,我花时间尝试找到解决此问题的方法。 EtsyBlur我正在使用该库来显示framgentDialog。一切正常,但主要活动是打开按钮上的键盘和脉冲打开通道,但它打开了键盘无法处理可绘制模糊的视图。
MainActivity{
description.addTextChangedListener(watcher);
hide_keyboard(PostActivity.this);
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
description.clearFocus();
PostFragment fragment = PostFragment.newInstance();
fragment.show(getSupportFragmentManager(), "dialog");
}
});[enter image description here][1]void hide_keyboard(Activity activity) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
//Find the currently focused view, so we can grab the correct window token from it.
View view = activity.getCurrentFocus();
//If no view currently has focus, create a new one, just so we can grab a window token from it
if(view == null) {
view = new View(activity);
}
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY);
}
我的DialogFragment类
public class PostFragment extends DialogFragment {
private static final int TAKE_PICTURE = 1;
private BlurDialogFragmentHelper mHelper;
public static PostFragment newInstance() {
PostFragment fragment = new PostFragment();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHelper = new BlurDialogFragmentHelper(this);
mHelper.onCreate();
setStyle(DialogFragment.STYLE_NORMAL, R.style.Theme_Transparent);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.dialog_post, container, false);
ImageView gallery = (ImageView) v.findViewById(R.id.galleryButton);
ImageView camera = (ImageView) v.findViewById(R.id.cameraButton);
ImageView video = (ImageView) v.findViewById(R.id.videoButton);