Android输入法之——如何在代码中强制切换输入法

转载自:http://xiaohang.org/2011/02/android%E8%BE%93%E5%85%A5%E6%B3%95%E4%B9%8B%E2%80%94%E2%80%94%E5%A6%82%E4%BD%95%E5%9C%A8%E4%BB%A3%E7%A0%81%E4%B8%AD%E5%BC%BA%E5%88%B6%E5%88%87%E6%8D%A2%E8%BE%93%E5%85%A5%E6%B3%95/

由于工作需要,追踪Android输入法Framework中了关于输入法切换的实现过程或者说是API调用的部分。
找到如下两个API:

1.InputMethodManager.setInputMethod (IBinder token, String id)
public void setInputMethod (IBinder token, String id)
Force switch to a new input method component. This can only be called from the currently active input method, as validated by the given token.
Parameters
token Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself.
id The unique identifier for the new input method to be switched to.
此函数,当然是可以实现输入法的强制切换的,但是,IBinder的获得却需要一定的权限&

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值