Advertisemnet

Earn Extra Money At Home. Starting from Now!!!

Tuesday, March 27, 2012

Android Chapter 2 : Customize Buttons

Hello everyone, welcome back. This is Android Chapter 2 : Customize Buttons.
I'm Mihiran Rupasinghe. Today, we'll see how you can customize your application buttons as you wish.

In order to customize your buttons will have to have xml files in "Drawable" folder and images in your "Drawable-hdpi" folder. You can create xml file like this.

1. click the button "Open wizard to help create a new Android XML file".
2. Select 'Drawable' in Resource Type.
3. Select your project and give a suitable name.
4. Select 'selector' for the root element.

Now you have a XML file like this.


You have to modify it like this.


"btnpressed" and "btndefault" are my images (.png) which are in Drawable-hdpi folder. And you can call the xml file in your layout. Coding of my "Sign In" button in Sign In page is shown below. (with my two images buttons)


"btn" is my xml file which is in Drawable folder.

See you in the next Chapter.

No comments:

Post a Comment