O'Reilly logo

Android Development Tools for Eclipse by Sanjay Shah, Khirulnizam Abd Rahman

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

Using the graphical layout designer

The next exercise is to add a text label, a text box and a button. These elements are called widgets in Android which has the class name TextView, EditText and Button in the Android API. We will not go through the details of these classes; most importantly we could apply these widgets in our app.

To open this layout, double-click the res/layout/activity_main.xml file from the project explorer.

On the left of the app screen, you'll see the Palette. Browse the Form Widgets, there are several widgets including the TextView. Click and drag the TextView widgets to the app screen. Change the widget ID into "@+id/tvName", and make sure to press Enter to confirm your changes and save them to the XML file. The "@+id/" ...

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