Android – Custom toggle button example

Android – Custom toggle button example

Problem: How to customize toggle button with custom images in android?
Solution:

Step 1: Create 2 images for ON and OFF state of toggle button, place these 2 images inside the Drawable folder. FYI, i have used 9-patch tool to create images for the states.

Step 2: Now, create a selector file for your toggle button, which is used to get state of button and define drawable accordingly.

I am now a DZone MVB (Most Valuable Blogger)

I am now a DZone MVB (Most Valuable Blogger)

Today, one more feather is added in my crown…..Yeh 🙂 🙂 FYI, this is the 2nd feather, 1st was JavaCodeGeeks 🙂

Let me tell you exactly!!

Few days ago, Mr. Mitch Pronschinske ,Senior Content Curator and Editor-in chief at DZone contacted me and saying that “With the quality of writing displayed in your blog, I’d be honored to invite you into our program”, at that time i knew just little about this program so i had contacted Mr. Juhani Lehtimaki (Founder of Android UI Design Patterns) as he is also a DZone MVB. I was convinced that this was a great opportunity. I humbly accepted the invitation.

Now, i am proud to say I am now a DZone MVB (Most Valuable Blogger).