Building Arduino Projects for the Internet of Things

(Steven Felgate) #1

CHAPTER 5 ■ IOT PATTERNS: REALTIME CLIENTS


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 Text view.
Switch to Text view and you will be able to see the screen layout in XML, as shown
in Listing 5-8. This layout file acts as a container for other sub-layout files. As you can
see in Listing 5-8 , content_main is included in the activity_main.xml layout file.


Listing 5-8. 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.intrusiondetectionsystem.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 5-12. Default development view of Android Studio

Free download pdf