All spaced out!

Android gravity, layout_gravity, padding and margins icon

Don’t be confused by:

  • The gravity and layout_gravity attributes
  • padding and margins

Check out these quick examples…

How to keep your clothes on and have fun with text!

Android TextView icon

You use the TextView class to display text to the user.

Although you can also edit the text displayed in text views, it’s best to use the TextView subclass, EditText to do that.

The TextView class has a number of attributes that you can use to make your text really stand out. We’ll show you a few to whet your appetite.

Read on to see how to:

  • Create and position a TextView in a RelativeLayout in code
  • Add shadows to your text
  • Rotate your text
  • How to use different font families to impress with your text

Throw your weight around

Android layout_weight attribute weight icon

Linear layouts support a layout_weight attribute.

We can use the weight attribute to allocate a portion of the layout’s space to a view, depending on its weight.

All views have a default weight of 0.

You can set a weight attribute using a float value for any view that you use in a LinearLayout. Android will then divide the available space up amongst the views proportionately, depending on their weight values.

Softly, softly. Using Android’s soft keyboard: A tutorial

Android soft keyboard tutorial icon

In the introduction, we covered the basics of using soft keyboards.  If you haven’t read it yet, you’ll find it here: Android’s soft keyboard. An introduction.

In this tutorial, we’ll show you how to use the soft keyboard in your apps.

Softly, softly. Using Android’s soft keyboard: An introduction

Android soft keyboard introduction icon

Need to capture text input in your app?

Android supports an on-screen soft keyboard as well as attached hardware keyboards.

The soft keyboard appears when a text field is in focus and disappears when it’s out of focus. The keyboard positions itself at the bottom of the screen over the app window. It has its own editing area.

In this introduction, we’ll cover the basics of using soft keyboards. Later, in a follow up tutorial, we’ll show you how to use the soft keyboard in your apps.

Localizing your resources

Keeping it local

Android localisation icon

Android apps can be installed on devices around the world. If you want to distribute your app to this large market, then you should provide alternative resources such as text, sound and images.

Android makes it easy to include alternative strings, sound files, layouts and images so that your app will work in any country and in any language.

Our tutorial app will show you how to include alternative text and image resources.

Android's SeekBar: a tutorial

Using a SeekBar to change the size of text in a TextView

Android SeekBar icon

Seek Bars are like Progress Bars, with a slight difference. The user determines the progress by moving a slider.

We’ll show you how to use a SeekBar to change the size of text in a TextView.

Search and you will find

Android search icon

You can use Android’s search framework to search data on a device as well on the internet.

Our tutorial will show you how to use the SearchView Widget and the Search Dialog to do searches.

Drag and Drop tutorial

Moving stuff around: Dragging and dropping

Android Drag and Drop icon

Android’s Drag and drop framework enables you to drag and drop data between views.

We’ll show you how to drag an image from one layout and drop it into another.

Just like the movies: Frame Animation

Android Frame Animation icon

View Animations include Tween and Frame animations. Frame animations are also known as Drawable animations.

You define the Frame animation in XML and save it as a drawable. The animation is then displayed as a sequence of images in an image view.