Contents

Android Developer Reference

This is the official Google Android site for developers. Here you will find all the documentation you need to develop rich android applications.

You will most likely visit this site often.

All tutorials and sample code are credited to their respected owners.

Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

TextView

This topic covers the android textview widget.

The TextView displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing; see EditText for a subclass that configures the text view for editing.

The Android SDK includes a simple text control for use within your layouts: TextView (android.widget.TextView). A good example of TextView control usage would be to display textual labels for other controls, like "Enter Date:", "Enter Name:" or "Enter a Password:" etc...

A sample layout file is show below with the TextView widget code in place.

To configure how the TextView control looks and behaves, you can adjust the control's attributes by selecting the control (either in the Component Tree window or the Preview window) and changing its attributes, as shown on the Properties Tab. You can also edit the XML file directly if you desire.

Specific attributes of TextView widgets you will want to be aware of:

Some of the most common properties of the TextView are: