0% found this document useful (0 votes)
41 views

Android Basic Day 1

Here are the steps to add ScrollView to FormActivity: 1. Open FormActivity.xml layout file 2. Add ScrollView as the root view 3. Move all existing views inside the ScrollView 4. The layout should have a single child - LinearLayout 5. Place all existing views inside the LinearLayout This will allow the content to be scrollable if it exceeds the screen height.

Uploaded by

Taz Sugiyanto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Android Basic Day 1

Here are the steps to add ScrollView to FormActivity: 1. Open FormActivity.xml layout file 2. Add ScrollView as the root view 3. Move all existing views inside the ScrollView 4. The layout should have a single child - LinearLayout 5. Place all existing views inside the LinearLayout This will allow the content to be scrollable if it exceeds the screen height.

Uploaded by

Taz Sugiyanto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

Rumah Coding Course

"Android Basic"
Studi Kasus Aplikasi "SekolahKu"

Day 1
Course Syllabus

Activity Layout View Resources

Custom
Menu ListView SQLite
Adapter
Course Overview

Final
Day 1 Day 2 Day 3 Day 4 Interview Certificate
Project

Final Project Duration: 1 Week


Course Breakdown
Day 1 Day 2 Day 3 Day 4

• Intro to • Toast • Activity • Context Menu


Android Studio • Menu Lifecycle • SearchView
• Intro to Java & • Form • Custom Array • Edit Data
XML Validation Adapter • Delete Data
• Activity • Intro to SQLite • Intent • Search Data
• View • Create Model • Create Detail • Change Icon
• Layout • Save Data Activity
• Add Login
• Create • List View • Add Splash Page
Complete Screen
• Array Adapter • Generate
Form Activity Signed APK
Development Tool
• JDK 7/8
• Android Studio
• Big Nox App Player
Splash Screen
Login Screen
Home Screen
Add Form
Detail Screen
Try It!

s.id/SekolahKu
Mobile App Developments
Create New Project
 App Name: SekolahKu
 Min SDK: 15
 Target SDK: 25
Introduction to Android Studio
Project
Structure
Android Manifest

 Every application must have an AndroidManifest.xml file (with


precisely that name) in its root directory. The manifest file
provides essential information about your app to the Android
system, which the system must have before it can run any of the
app's code.
 It describes the components of the application, which include the
activities, services, broadcast receivers, and content providers
that compose the application.
 It declares the permissions
Java & XML

XML Java
• Define Layout • Define Action
• Act as View • Act as Controller
Sample XML Code
XML
Java
• Define an action, ex: Do something when the button is
clicked by user
Activity
Activity is a
screen
Activity consist of Java and XML

Java

Activity
XML
Task #1 Create new activity:
TestActivity
View
What is View?

 View represents the basic building block for user


interface components.
 A View occupies a rectangular area on the screen
and is responsible for drawing and event handling.
TextView
TextView is a static text. It is
used for labeling

Try create some TextView then


play with it's attributes.
Button
Represents a push-button
widget. Push-buttons can be
pressed, or clicked, by the
user to perform an action.

Try create some Button


then play with it's
attributes.
Edit Text
Edit Text is a complete text edit. User
can write some text on it

Try create some EditText then play with


it's attributes.
Check Box
A checkbox is a specific type of
two-states button that can be either
checked or unchecked

Try create some CheckBox then


play with it's attributes.
Radio Button
Radio buttons allow the user to
select one option from a set.

Try create some RadioButton


then play with it's attributes.
Spinner
Spinners provide a quick way to
select one value from a set.

Try create a Spinner then


populate items using attribute
android:entries
Image View
Displays an arbitrary image, such
as an icon, logo or other.

Try create some ImageView using


ic_launcher as it's source
Layout
Linear Layout
Arranges view in vertical or horizontal order
Task #2
Create this layout
Task #3
Create this layout
Task #4
Create this layout
Layout Weight
• LinearLayout also supports
assigning a weight to individual
children with the
android:layout_weight attribute.
This attribute assigns an
"importance" value to a view in
terms of how much space it
should occupy on the screen
Task #5
Create this layout
Relative Layout
RelativeLayout is a view group
that displays child views in
relative positions.
Task #6: Create this layout
Task #7: Create this layout
Tips for Creating More Complex
Layout
 Use LinearLayout whenever it's possible.
 If it isn't possible to use LinearLayout, You can use
RelativeLayout.
 You can combine LinearLayout and RelativeLayout as well
within a single page to match the required condition.
Task #8
Create form activity and
create this layout
Padding & Margin

 Padding is the space inside the border, between the border and
the actual view's content. Note that padding goes completely
around the content: there is padding on the top, bottom, right
and left sides (which can be independent).
 Margins are the spaces outside the border, between the border
and the other elements next to this view. In the image, the
margin is the grey area outside the entire object. Note that, like
the padding, the margin goes completely around the content:
there are margins on the top, bottom, right, and left sides.
Padding & Margin
Padding & Margin

 To give a padding on View,  To give a margin on View, use these


use these attributes: attributes:
 android:padding (all side)  android:layout_margin (all side)
 android:paddingLeft  android:layout_marginLeft
 android:paddingTop  android:layout_marginTop
 android:paddingRight  android:layout_marginRight
 android:paddingBottom.  android:layout_marginBottom.
Task #8
Give margin to your
Form on all sides.
Set Startup Activity

 Open AndroidManifest.xml and add the following code between


<activity> tag:
Task #9
Add TextInputLayout to
all EditText fields
Scroll View

 A view group that allows the view hierarchy placed within it to be


scrolled.
 Scroll View may have only one direct child placed within it. To
add multiple views within the scroll view, make the direct child
you add a view group, for example LinearLayout, and place
additional views within that LinearLayout.
Task #10
Add ScrollView to FormActivity

You might also like