setClickable(),好像是控制按钮是否可以被点击和点击之后触发监听器事件。
setFocusable();控制键盘是否可以获得这个按钮的焦点。(我按实体键盘上方向键,button被选中)

 今天想使用设置background的方法更改linearlayout的点击时的背景,发现不好用,原来没设置clickable,待总结。

<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"  android:drawable="@color/gray" />
    <item android:state_pressed="false"  android:drawable="@color/clear" />


</selector> 

 

待总结,做个记号

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2021-11-26
  • 2021-09-08
相关资源
相似解决方案