惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - 清炒白菜

Unable to resume activity : android.database.StaleDataException: Attempted to access a cursor after it has been closed. 异常 Android的匿名Handler类引起的内存泄露 计算2个经纬度之间的距离 用bcp导入DateTime类型的数据 Linux下提示“omitting directory”错误的解决办法 Android的"返回“功能 获取当前Activity的Root View 用代码动态设置ImageView的align布局 Android中Sqlite数据库多线程并发问题 [转]Java的数组(Array)、Vector、ArrayList、HashMap的异同 HTML中element.style取值问题 用bcp导入大量数据(代替INSERT) ajax跨域访问问题 又一款分布式版本控制工具Mercurial bcp导入导出数据发生异常解决方案 - 清炒白菜 - 博客园 导出Google Reader中加星的内容项 - 清炒白菜 - 博客园 在win下使用GIT dotNet 自带线程池与HTTP访问的若干疑问 解决"the database principal owns a schema in the database and cannot be dropped"问题
EditText获得焦点后,如何关闭软键盘
清炒白菜 · 2011-09-20 · via 博客园 - 清炒白菜

2011-09-20 23:01  清炒白菜  阅读(754)  评论()    收藏  举报

EditText获得焦点后, 会自动打开软键盘,这时候想让“EditText失去焦点,并关闭软键盘”, 暂时还没有找到完美的解决方案,因为EditText失去焦点功能未能完美实现。

所以采用了OnTouch Activity上某个大块控件,强制关闭软键盘的方法。

getListView().setOnTouchListener(new OnTouchListener() {

@Override

public boolean onTouch(View v, MotionEvent event) {

hideSoftKeyboard();

return false;

}

});

private void hideSoftKeyboard(){

InputMethodManager inputManger = (InputMethodManager) getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE);

if(inputManger != null){

inputManger.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);

}

}

getListView()可以改成任意其他需要做事件绑定的控件对象。