按钮3D样式文本填充

时间:2013-07-22 07:30:04

标签: android button text styles padding

我的主屏幕上有一些按钮。这些都是由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。

我该如何实现?

1 个答案:

答案 0 :(得分: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>