From the course: Android Development Essential Training: 1 Your First App
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Implement designs in XML layouts - Android Tutorial
From the course: Android Development Essential Training: 1 Your First App
Implement designs in XML layouts
- [Instructor] When your activity is first displayed to the user, its setContentView method is called. This method accepts an integer value that corresponds to your XML layout file. Behind the scenes, a file is generated named R. The R file holds resource IDs for all of the resources in your resource directory, but you don't have to worry about looking for it. There are rules for how you can access your resources in code. Here's the syntax for accessing your resources in code. For each type of resource, there's an R subclass. For example, R.string for all string resources, and for each resource of that type, there's a static integer. For example, R.string.app underscore name. This integer is the resource ID that you can use to retrieve your resource. The file extension is not included in the reference. Let's give it a try. Let's say you need a drawable resource named, Icon. Which of the following is the correct way…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Define screens with activities4m 20s
-
(Locked)
Implement designs in XML layouts2m 47s
-
(Locked)
Introduction to Views and ViewGroups3m 19s
-
(Locked)
Display Views in a ViewGroup3m 28s
-
(Locked)
Units of measurement in Android4m 10s
-
(Locked)
Challenge: App template1m
-
(Locked)
Solution: App template3m 20s
-
(Locked)
-