1

我的主屏幕上有一些按钮。这些都是由 buttonstyle 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/button_faq" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/button_faq_pushed" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/button_faq_pushed" />
<item android:drawable="@drawable/button_faq" />
</selector>

为了使其更加 3D,如果按下按钮,我想将 Button-Text 向下 4px。

我该如何实施?

4

1 回答 1

0

尝试添加形状并使用填充值:

<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/button_faq" android:state_focused="true" android:state_pressed="false"/>
    <item android:drawable="@drawable/button_faq_pushed" android:state_focused="true" android:state_pressed="true">
            <shape>
                 <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
            </shape>
    </item>
    <item android:="" android:drawable="@drawable/button_faq_pushed" android:state_focused="false" android:state_pressed="true"/>
    <item android:drawable="@drawable/button_faq"/>

</selector>
于 2013-07-22T08:07:34.317 回答