2012-04-04 27 views
0

enter image description here定製的Android按鈕的外觀和感覺

的兩個按鈕在屏幕的底部是掃描和信息,如果我們點擊任何按鈕,按鈕的視圖可見像壓爲u圖像查看引導按鈕,這個視圖將根據按鈕點擊而改變,並且在這裏我無法爲按鈕創建那種外觀和感覺。請提供示例代碼或者建議我實現這種外觀和感覺。

感謝你

+0

這是一個梯度施加到該按鈕作爲背景可繪製在2 states.Seleted和非選中。看看這裏http://stackoverflow.com/questions/7419539/background-gradient – weakwire 2012-04-04 11:27:56

+0

看到http://stackoverflow.com/questions/1521640/standard-android-button-with-a-different-color – ngesh 2012-04-04 11:29:48

+0

非常感謝你。 .. – AndroidBeginner 2012-04-05 12:27:53

回答

0
<?xml version="1.0" encoding="utf-8"?> 

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

    <item android:drawable="@drawable/button_some_name_pressed" android:state_pressed="true"/> 
    <item android:drawable="@drawable/button_some_name_default"/> 

</selector> 

/drawable/文件夾都以此爲button_some_name.xml

然後讓button_some_name_pressed.png & button_some_name_pressed.pngdrawable-ldpidrawable-mdpi

還有其他國家考慮以及

ref:http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList