的兩個按鈕在屏幕的底部是掃描和信息,如果我們點擊任何按鈕,按鈕的視圖可見像壓爲u圖像查看引導按鈕,這個視圖將根據按鈕點擊而改變,並且在這裏我無法爲按鈕創建那種外觀和感覺。請提供示例代碼或者建議我實現這種外觀和感覺。
感謝你
的兩個按鈕在屏幕的底部是掃描和信息,如果我們點擊任何按鈕,按鈕的視圖可見像壓爲u圖像查看引導按鈕,這個視圖將根據按鈕點擊而改變,並且在這裏我無法爲按鈕創建那種外觀和感覺。請提供示例代碼或者建議我實現這種外觀和感覺。
感謝你
這是自定義按鈕。自定義按鈕非常容易創建,您只需爲按鈕的不同狀態製作不同的圖像並將其放置到res/drawable文件夾中即可。 下面鏈接包含分步描述用於創建這樣的:
http://androidemulator.wordpress.com/2011/11/03/creating-custom-buttons-in-android-applications/
<?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.png
在drawable-ldpi
drawable-mdpi
等
還有其他國家考慮以及
ref:http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList
這是一個梯度施加到該按鈕作爲背景可繪製在2 states.Seleted和非選中。看看這裏http://stackoverflow.com/questions/7419539/background-gradient – weakwire 2012-04-04 11:27:56
看到http://stackoverflow.com/questions/1521640/standard-android-button-with-a-different-color – ngesh 2012-04-04 11:29:48
非常感謝你。 .. – AndroidBeginner 2012-04-05 12:27:53