Last Updated on December 19, 2020 by AbdurRahman G Official | Md Ghufran Salafi
Create a Birthday Card app:
Learn more
- Vocabulary for Android Basics in Kotlin
View
TextView
ConstraintLayout
- dp vs. sp
- Layout Editor in Android Studio
Learn more
- Vocabulary for Android Basics in Kotlin
- Resource Manager in Android Studio
ImageView
class- Accessibility
- Support different languages
- Getting started with GitHub
- https://developer.android.com/reference/kotlin/android/widget/ImageView.ScaleType?authuser=1
- https://support.google.com/accessibility/android/answer/6283677?hl=en&authuser=1
- https://developer.android.com/guide/topics/media/media-formats?authuser=1#image-formats
Short and Full Forms:
dp = density-independent pixels
sp = scalable pixels
Solutions from Android Developer Official Site:
Solution code
The solution code for the Happy Birthday app has been uploaded to GitHub, in case you’d like to see the code that we ended up with.
GitHub is a service that allows developers to manage code for their software projects. It uses Git, which is a version control system that keeps track of the changes made for each version of the code. If you’ve ever seen the version history of a Google Doc, you can see when and what edits were made on the document in the past. Similarly, you can track the version history of the code in a project. This is very helpful if you are working on a project as an individual or with a team.
GitHub also has a website where you can view and manage your project. This GitHub link allows you to browse the Happy Birthday project files online or download them to your computer.
To get the code for this codelab and open it in Android Studio, do the following.
Get the code
- Click on the Solution Code URL. This opens the GitHub page for the project in a browser.
- On the GitHub page for the project, click the Clone or download button, which brings up a Clone dialog.
- In the dialog, click the Download ZIP button to save the project to your computer. Wait for the download to complete.
- Locate the file on your computer (likely in the Downloads folder).
- Double-click the ZIP file to unpack it. This creates a new folder that contains the project files.
Open the project in Android Studio
- Start Android Studio.
- In the Welcome to Android Studio window, click Open an existing Android Studio project.
Note: If Android Studio is already open, instead, select the File > New > Import Project menu option.
- In the Import Project dialog, navigate to where the unzipped project folder is located (likely in your Downloads folder).
- Double-click on that project folder.
- Wait for Android Studio to open the project.
- Click the Run button
to build and run the app. Make sure it works as expected.
- Browse the project files in the Project tool window to see how the app was implemented.
Solutions from AbdurRahman G:
Project on Github:
https://github.com/AbdurRahmanG/Happy-Birthday-Card-App-in-Kotlin
App Links:
Summary
- The Layout Editor helps you create the UI for your Android app.
- Almost everything you see on the screen of your app is a
View
. - A
TextView
is a UI element for displaying text in your app. - A
ConstraintLayout
is a container for other UI elements. Views
need to be constrained horizontally and vertically within aConstraintLayout
.- One way to position a
View
is with a margin. - A margin says how far a
View
is from an edge of the container it’s in. - You can set attributes on a
TextView
like the font, text size, and color.
Summary
- The Resource Manager in Android Studio helps you add and organize your images and other resources.
- An
ImageView
is a UI element for displaying images in your app. ImageViews
should have a content description to help make your app more accessible.- Text that is shown to the user like the birthday greeting should be extracted into a string resource to make it easier to translate your app into other languages.