This free video presentation is created using RenderForest. Paid service includes watermark removal and high-res quality.

Android layout & Views

Android layout refers to arrangement of elements on a page such as images, texts, and styles. All elements in layout are built using Views and ViewGroups. Layouts also have widgets like buttons, labels, textboxes, etc.

View is an user interface that occupies area on the screen and is responsible for drawing and event handling. View is also a superclass of all graphical user interface components.

Further reading

Layout files (xml) in android studio

User interface objects (menu, icon, images, audio, animation, text strings. colors) are placed in folder res

Main Layout – activity_main.xml

This is the app UI when it is run on a mobile device. I’ll describe 2 main layouts files since the other layout files are less complex .

activity_main.xml
activity_gamelist.xml

activity_main.xml will determine how the global UI of the Activity should be. It is the “outer” part of the activity layout (toolbar, action button, etc.). The layout is separated into several segments in xml.

supportActionBar: Dedicated space for the app
IITopBar: Countdown timer & call-to-action banner linking to credit card payment
rvBoard: Recyclerview displays the card matching game. 
linearLayoutMain: Buttons for levels & timer adjustment
adView: Admob advertisement
activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
Read more

Game listing layout – activity_gamelist.xml

The layout displays all the card games. These card games are created by users, store in Firebase Realtime Database and populate the display in recyclerview using the FirebaseUI. FirebaseUI is an open-source library for Android that provides to quickly connect common UI elements to Firebase APIs.

All Firebase Realtime Database data is stored as JSON objects. Unlike a SQL database, there are no tables or records. When you add data to the JSON tree, it becomes a node in the existing JSON structure with an associated key. Firebase is very much not like a relational database. You can compare it to a hierarchical database.

Layout – activity_gamelist.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
Read more