赞
踩
可以为EditText指定android:imeOptions属性,这时右下角会多出一个相应的按钮,例如将属性值设置为"actionSend",将会出现发送按钮,在代码中可以为该EditText指定setOnEditorActionListener动作监听,完成相应的操作,例如:
EditText editText = (EditText) findViewById(R.id.search); editText.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean handled = false; if (actionId == EditorInfo.IME_ACTION_SEND) { sendMessage(); handled = true; } return handled; } });requestFocus() : 判断当前的EditText是否在焦点上
InputMethodManager : 可以控制软键盘是否显示<activity>android:windowSoftInputMode节点,用来指定,软键盘弹出时,如何适配自己的布局.
adjustResize : 自己的布局会全部都显示,不隐藏
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。