From the course: Android Development Essential Training: 1 Your First App

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Display Views in a ViewGroup

Display Views in a ViewGroup - Android Tutorial

From the course: Android Development Essential Training: 1 Your First App

Start my 1-month free trial

Display Views in a ViewGroup

- [Instructor] You can design user interface layouts in the same way you create webpages in HTML, using nested elements. In Android, each layout file must contain exactly one root element, like you see here with this LinearLayout. Once you've defined the root element, you can add additional layouts or widgets as children in order to define your user interface. Every view in view group objects supports their own variety of XML attributes. These attributes have the following characteristics. Some are inherited from the base view class, others are specific to the type of view object that is being configured. And finally, some relate to how the view is positioned inside its parent. Let's look at a few examples. We're back in Android Studio with the activity_main.xml file. Let's walk through this line by line, so you know exactly how attributes work in XML. On line one, this is how we specify that this is an XML file.…

Contents