O'Reilly logo

Xamarin Studio for Android Programming: A C# Cookbook by Mathieu Nayrolles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Customizing components

Using Xamarin Studio for Android, you can customize how your components look.

Getting ready

Create a new Android project, CustomizingComponents.

How to do it...

As an example, we will perform the transformation of a button. First, create your three images corresponding to the button being pressed, focused, and normal, and then add them to the Drawable resources. Then, create a new layout named customizedButton.axml under the Resource/Layout folder. This file will look like the following code sample that defines the images corresponding to the three states:

<?xml version="1.0" encoding="utf-8"?> <selector> <item android:drawable="@drawable/pressed_state" android:state_pressed="true" /> <item android:drawable="@drawable/focused_state ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required