当前位置:编程学习 > wap >>

InputConnection中的onCreateInputConnection()需要显示调用么? 怎么获取软键盘输入?

//在自定义控件中
class MyInputConnection extends BaseInputConnection{
    public MyInputConnection(View targetView, boolean fullEditor) { 
        super(targetView, fullEditor); 
        // TODO Auto-generated constructor stub 
    } 
    public boolean commitText(CharSequence text, int newCursorPosition){ 
        inputString=inputString+(String) text;
        Log.i("TAG", "hello");
        Log.i("TAG", inputString);
        return true; 
    }
    
}

public InputConnection onCreateInputConnection(EditorInfo outAttrs) { 
        // TODO Auto-generated method stub 
Log.i("TAG", "hlll");
        return new MyInputConnection(this,false);//super.onCreateInputConnection(outAttrs); 
    }
能够实现输入法的现实与隐藏,但是以上几个TAG都没打印出来是怎么回事,
即使我显示调用了onCreateInputConnection(),commitText()还是不会调用到,
我是想获得软键盘的输入,然后传给其他控件显示,该如何解决啊 --------------------编程问答-------------------- 输入法服务没调用,输入法自然不会起来,类构造函数应该加上这句启动服务吧
input=(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,