Android按钮照明边框

时间:2011-05-28 16:25:33

标签: android button

是否可以点亮按钮上的按钮边框(您可以在放置ImageView并单击它时看到效果)。需要说的是,我有一个关于丁香的背景。

2 个答案:

答案 0 :(得分:2)

您需要有两个图像,并将每个图像分配给一个按钮状态。您应该创建一个可绘制的状态列表:只需创建一个xml文件“button.xml”并将其放在res / drawable文件夹中。 xml看起来像这样:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
        android:drawable="@drawable/buttonwithglow" />
    <item android:state_pressed="false"
        android:drawable="@drawable/buttonwithoutglow" />
</selector>

答案 1 :(得分:0)