开发者

Android Button lighting border

Is it any way to light the borders of a button whilte开发者_Go百科 pressing on it (you can see the effect when you place an ImageView and click on it). Needed to say, that i have a background on the buttone.


You need to have two images and assign each of them to one button state. You should make a state list drawable: just create an xml file "button.xml" and place it in your res/drawable folder. The xml would look like this:

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


Use a StateListDrawable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜