Building Arduino Projects for the Internet of Things

(Steven Felgate) #1

CHAPTER 6 ■ IOT PATTERNS: REMOTE CONTROL


There are two options to customize screen layout—you can either use the drag-and-drop
feature in Design view or manually edit the XML file in Text view. We are going to directly edit
the XML in the Text view.
Switch from Design view to Text view and you will be able to see the screen layout in
XML, as shown in Listing 6-1. This layout file acts as a container for other sublayout files.
As you can see in Listing 6-1 , content_main is included in the activity_main.xml layout file.


Listing 6-1. Default Text View of activity_main.xml


<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.codifythings.lightingcontrolsystem.MainActivity">


<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">


<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"


Figure 6-12. Default development view of Android Studio

Free download pdf