Sunday, April 17, 2011

how to change Image In Android

Put this code in ur Program 
 
 .XML file
<Button android:id="@+id/btnLogin" android:text="Login"
        android:background="@drawable/my_button" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:textColor="#FFFFFF"
        android:layout_marginTop="20dip"
        />

/drawable/button_login.xml

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

No comments:

Post a Comment