Книга: Beginning Android
What Is an XML-Based Layout?
What Is an XML-Based Layout?
As the name suggests, an XML-based layout is a specification of widgets’ relationships to each other — and to their containers (more on this in Chapter 7) — encoded in XML format. Specifically, Android considers XML-based layouts to be resources, and as such layout files are stored in the res/layout
directory inside your Android project.
Each XML file contains a tree of elements specifying a layout of widgets and their containers that make up one view hierarchy. The attributes of the XML elements are properties, describing how a widget should look or how a container should behave. For example, if a Button
element has an attribute value of android:textStyle = "bold"
, that means that the text appearing on the face of the button should be rendered in a boldface font style.
Android’s SDK ships with a tool (aapt
) which uses the layouts. This tool should be automatically invoked by your Android tool chain (e.g., Eclipse, Ant’s build.xml
). Of particular importance to you as a developer is that aapt
generates the R.java
source file within your project, allowing you to access layouts and widgets within those layouts directly from your Java code.
- Why Use XML-Based Layouts?
- CHAPTER 5 Using XML-Based Layouts
- OK, So What Does It Look Like?
- What’s with the @ Signs?
- Тестирование Web-сервиса XML с помощью WebDev.WebServer.exe
- Преобразование XML в реляционную базу данных
- Chapter 16. Commercial products based on Linux, iptables and netfilter
- What's next?
- What is an IP filter
- What NAT is used for and basic terms and expressions
- What is needed to build a NAT machine