自定义按钮:按下时更改样式

use*_*308 6 android state coding-style button

我使用样式创建了带阴影的按钮:

<style name="test">
  <item name="android:shadowColor">#FFFFFF</item>
  <item name="android:shadowRadius">1</item>
  <item name="android:shadowDx">1</item>
  <item name="android:shadowDy">1</item>
</style>
Run Code Online (Sandbox Code Playgroud)

这会在按钮文本的正常状态下应用白色阴影.我只是想知道是否有人知道当按钮处于按下状态时是否有一种方法可以移除这个阴影.换句话说,当按钮处于另一个(按下)状态时,有没有办法应用另一种风格?

提前致谢!

编辑

bold.xml:

<resources>
    <style name="bold_text">
        <item name="android:textStyle">bold</item>
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

button.xml:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/test_pressed"
              style="@style/bold_text"
          android:state_pressed="true"/>
    <item android:drawable="@drawable/test_focused"
          android:state_focused="true"/>
    <item android:drawable="@drawable/test_normal"/>
</selector>
Run Code Online (Sandbox Code Playgroud)

我的布局:

<Button
        ...
        android:background="@drawable/button"/>
Run Code Online (Sandbox Code Playgroud)