In the next installment of our series on the topic of Xamarin, we will be delving into an introduction of the structure of the Android project, which is completely different from iOS.
Xamarin: The structure of the Android project (part 5)
The Android project is again part of the entire solution, just as in the case of iOS. Familiar items from the iOS Project Properties and References are again available here. And their structure does not differ much either. Properties contains the file AssemblyInfo with metadata and the project version. In addition, the so-called AndroidManifest is in it. This file has a similar function as the Info.plist in iOS. There is a definition of the version of the application, permissions for access to different sensors, application icons etc. Within References, local libraries, projects and nugget packages to the project are available.
The folder that contains the folder with the UI definition. This includes layouts, images, color definitions etc. (all definitions are written in XML). For division, Google opted for different display definitions of expanded folder names. As an example, I will mention folders for the icon definitions:
The definitions of all folders:
- Drawable – folder that contains the pictures. Since Android supports several types of displays, it is necessary to prepare the images at different resolutions.
- Layout – definition of screen layouts
- Colors – folder with the color definitions
- Arrays – definitions of static fields, eg. for preferences
- Values – folder containing language string definitions
In addition to these folders and their files, the Resource.Designer file, which automatically assigns the defined resource identifier, is also visible here. If the identifier is not assigned automatically, it is necessary to REBUILD the project.
Other files consist only of .cs files. For example MainActivity, which defines the logic of the basic screen in Android. Just as in iOS, a screen with components is present here as well.