<Button
android:id="@+id/featured_listing_button_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-7dp"
android:background="@drawable/botton_account_middle_white"
android:text="Featured Listing" />
我尝试了什么 ::我已将按钮设为白色,其他一些属性
但现在不存在可点击效果!
botton_account_middle_white.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FFFFFF" />
<stroke
android:width="3px"
android:color="#000000" />
<corners android:radius="3dp" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</shape>
答案 0 :(得分:0)
您应该使用选择器突出显示按钮。
button_selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:state_selected="false"
android:state_pressed="false"
android:color="@color/normal" />
<item android:state_pressed="true"
android:color="@color/pressed" />
<item android:state_selected="true"
android:state_pressed="false"
android:color="@color/pressed" />
</selector>
像
一样使用它<Button
android:id="@+id/featured_listing_button_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-7dp"
android:background="@drawable/button_selector"
android:text="Featured Listing" />
答案 1 :(得分:0)
<?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="true"
android:drawable="@drawable/bgalt" />
<item android:state_focused="false" android:state_pressed="true"
android:drawable="@drawable/bgalt" />
<item android:drawable="@drawable/bgnorm" />
</selector>
<Button
android:id="@+id/mybutton"
android:background="@drawable/selector" />