1、设置进入activity不自动进入编辑框
在它的父控件中添加如下两行代码即可
android:focusable="true"
android:focusableInTouchMode="true"
第一种情况如下,会改变屏幕区域的大小
android:windowSoftInputMode="adjustResize"
第二种情况如下,会将所有控件向上顶
android:windowSoftInputMode="adjustPan"
在选择第一种方法的时候,可以将整个页面设为relativelayout,将控件从底部开始向上排,就可以保留住最下面的内容了。
考虑微信朋友圈的评论的实现,可以在点击评论按钮后在下方添加输入行,再将listview设定到评论项即可(未测试)
3、响应输入法中的回车键
textview.setOnEditorActionListener(new OnEditorActionListener(){
@Override
public boolean onEditorAction(TextView arg0, int arg1, KeyEvent arg2) {
// TODO Auto-generated method stub
return false;
}
});
也可以采用setOnKeyListener响应按键
同时,修改android:imeOptions属性,可以改变显示的文字