【发布时间】:2015-07-10 12:36:27
【问题描述】:
片段启动时如何打开键盘?我已经尝试过这段代码:
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view =inflater.inflate(R.layout.mylayout,container,false);
TextView TVLarghezza = (TextView) view.findViewById(R.id.larghezza);
TVLarghezza.requestFocus();
InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imgr.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
return view;
}
但它不起作用。我必须在启动时打开键盘。
【问题讨论】:
标签: android android-fragments keyboard