按钮三维样式文本填充



我的主屏幕上有一些按钮。这些都是由按钮样式的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,如果按下按钮,我想将按钮文本向下4倍。

我该如何实现?

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

<?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>

相关内容

  • 没有找到相关文章

最新更新