2010-03-13 46 views

回答

0

你需要编写自己的类为该。只是子类查看并监听onClick事件。

0

尝试使用选择器作为背景。

<Button 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/hello" 
     android:background="@drawable/my_button" 
    /> 

,然后作出my_button.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/focused" /> 
    <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/focusedpressed" /> 
    <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/pressed" /> 
    <item android:drawable="@drawable/defaultbutton" /> 
</selector> 

来源:http://www.anddev.org/tinytutcustom_button_backgrounds-better_imagebutton-t4298.html