Designing Layouts Using the Layout Resource Editor

You can design and preview layouts in Eclipse by using the layout resource editor (see Figure 4.2). If you click on the project file /res/layout/main.xml, you see a Layout tab, which shows you the preview of the layout. You can add and remove layout controls by using the Outline tab. You can set individual properties and attributes by using the Properties tab.

FIGURE 4.2

The layout resource editor in Eclipse.

FIGURE 4.2

The layout resource editor in Eclipse.

Like most other user interface designers, the layout resource editor works well for basic layout design. However, the layout resource editor does not fully support all View controls. For some of the more complex user interface controls, you might be forced to edit the XML by hand. You might also lose the ability to preview your layout if you add any of these controls to your layout. In such a case, you can still view your layout by running your application in the emulator or on a handset. Displaying an application correctly on a handset, rather than the Eclipse layout editor, should be a developer's primary objective.

0 0

Post a comment