Java 如果键盘打开,则出现BlurDialogFragmentHelper错误
提前感谢,我花时间试图找到这个问题的解决方案。EtsyBlur我正在使用库来显示FramGetDialog。一切正常,但主要的活动是打开键盘并按按钮打开通道,但它会打开键盘无法工作的视图Java 如果键盘打开,则出现BlurDialogFragmentHelper错误,java,android,dialog,keyboard,fragment,Java,Android,Dialog,Keyboard,Fragment,提前感谢,我花时间试图找到这个问题的解决方案。EtsyBlur我正在使用库来显示FramGetDialog。一切正常,但主要的活动是打开键盘并按按钮打开通道,但它会打开键盘无法工作的视图 MainActivity{ description.addTextChangedListener(watcher); hide_keyboard(PostActivity.this); add.setOnClickListener(new View.OnClickListen
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);
}
我的对话片段类
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);