TextView/Button 获取焦点、选中状态样式
当接入外接键盘 按下左右键使得控件活动焦点,同时点击效果也能生效
state_pressed(先) 和 state_focused(后) 想要生效得注意先后顺序
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<corners
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
<solid android:color="#64DD17" />
<stroke
android:width="5dp"
android:color="#00C853" />
</shape>
</item>
<item android:state_focused="true" >
<shape>
<corners
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
<solid android:color="#2962FF" />
<stroke
android:width="5dp"
android:color="#00B8D4" />
</shape>
</item>
<item>
<shape>
<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="0dp" android:topRightRadius="0dp" />
<solid android:color="#FFF" />
</shape>
</item>
</selector>