Practice Building Android Layouts / Udacity course Lesson 4 notes

Sharing my draft notes from Udacity’s Android Basics - Lesson 4 online course

The course actually gave instructions and a challenge of building your own card as android app using Android Studio and deploying in a real Android device.

Here are my notes which can be found also at My GistHub:

Preparing to work with Android

From Design to Code

  1. Identify the Views to use (TextView? ImageView?)
  2. Position the Views (ViewGroups and positioning)
  3. Style the views (Fonts, colors, sizes, etc.)

Referencing an image

Images are saved in app/drawable folder. E.g androidparty.jpg.

Then they can be referenced as source from the ImageView.

1
2
3
<ImageView
...
android:src="@drawable/androidparty" />

Note: No need to add the extension of the image file.

A Sample ImageView

Use it as a quick reference for ImageView properties:

1
2
3
4
5
6
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/myImage"
/>

A Sample TextView

Use it as a quick reference for TextView properties:

1
2
3
4
5
6
7
8
9
10
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginLeft="16dp"
android:text="Hello World"
android:fontFamily="sans-serif-light"
android:textColor="@android:color/white"
android:textSize="32sp"
/>

Draw Your Own Card challenge

Here’s the reference to my own card that I created as part of the practical challenge of this lesson:
https://discussions.udacity.com/t/make-your-own-card/19643/6766

I actually created a Memory card for my son Orestis to remember the trip we took with “Mountzouris” Locomotive train last summer (2017).

Captain Out…