按键键值获取
<p>按键键值获取方式为Android标准API接口,Activity中重载onKeyDown方法即可</p>
<pre><code class="language-java">@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK &amp;amp;&amp;amp; event.getRepeatCount() == 0) {
//按下的如果是BACK,同时没有重复
//do something here return true;
}
return super.onKeyDown(keyCode, event);
}</code></pre>
<p>测试源码下载:<a href="http://www.szzkc.com/faqcontent-702.html">http://www.szzkc.com/faqcontent-702.html</a></p>