这段代码有什么我遗漏的吗?是的,我知道这主要是代码,但恕我直言,我认为这很清楚。仍然需要更多不必要的文本。
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState)
{
if(container == null) { return null; }
super.onCreateView(inflater, container, savedInstanceState);
final EditText editText = (EditText) outsideLayout.findViewById(R.id.prefPlayerName);
editText.setInputType(InputType.TYPE_TEXT_VARIATION_NORMAL);
editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
editText.setImeOptions(EditorInfo.IME_ACTION_GO);
editText.setOnKeyListener(new EditText.OnKeyListener()
{
@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
// If the event is a key-down event on the "enter" key
if((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER))
{
Log.i(TAG, "PrefDetailsFragment enter key pressed");
return true;
}
return false;
}
});
return outsideLayout;
} // onCreateView()