
这是我使用的XML文件:
<?xml version="1.0" enCoding="utf-8"?><selector xmlns:androID="http://schemas.androID.com/apk/res/androID" > <item androID:state_focused="true" androID:state_pressed="false" androID:drawable="@drawable/buttonbluepressed" /> <item androID:state_focused="true" androID:state_pressed="true" androID:drawable="@drawable/buttonbluepressed" /> <item androID:state_focused="false" androID:state_pressed="true" androID:drawable="@drawable/buttonbluepressed" /> <item androID:drawable="@drawable/buttonblue"/></selector>
以下是我如何使用它:
<button androID:ID="@+ID/button_choose" androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:layout_weight="1" androID:background="@drawable/choose_button" androID:onClick="onbuttonClicked" androID:text="@string/button_choose" />解决方法 你可以使用 setOnTouchListener作为:
button.setontouchListener(new OntouchListener() { @OverrIDe public boolean ontouch(VIEw v,MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN){ //button pressed } if(event.getAction() == MotionEvent.ACTION_UP){ //finger was lifted } return false; } }); 总结 以上是内存溢出为你收集整理的Android按钮悬停事件全部内容,希望文章能够帮你解决Android按钮悬停事件所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)