Android中按钮点击效果显示

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
	<item android:state_focused="true"  android:state_enabled="true" android:state_pressed="false" android:drawable="@drawable/btn_gb_n"></item>
	<item android:state_enabled="true" android:state_pressed="true" android:drawable="@drawable/btn_gb_p"></item>
	<item android:state_enabled="true" android:state_checked="true" android:drawable="@drawable/btn_gb_p"></item>
	<item android:drawable="@drawable/btn_gb_n"></item>
</selector>

 以上为按钮backgroud所引用的配置文件

按钮对应的xml文件为:

 <Button 
    	android:id="@+id/btn"
    	android:layout_width="wrap_content"
    	android:layout_height="wrap_content"
    	android:background="@drawable/loginbutton"
    	android:text="@string/test"
    	android:layout_gravity="center"
    	android:layout_marginTop="20dip"
    	android:textColor="@color/white"
    />

 

你可能感兴趣的:(android)