Professional Documents
Culture Documents
Android App Development - Front-End
Android App Development - Front-End
Hajrah Jahan
Overview
• Front-end
• XML
• Android Layouts
○ Linear Layout
○ Imageview
○ Values
XML - eXtensible Markup Language
whitespace.
● All the tags corresponding to various components of your UI must be placed between the
Common Layouts
● A Relative Layout displays its child content in positions relative to the parent.
● A Linear Layout aligns its contents into a single direction, vertical or horizontal.
● A Frame Layout is a placeholder on a screen that displays only a single view, i.e., A Fragment.
Views
● View Group is an invisible container that holds multiple views together and defines their layout
properties.
● It is used to point to and provide access to all the XML Tags created to design Android Apps.
XML tags for Android
Layouts and ViewGroups
Attributes in a Tag
● Android:id
○ Gives your component or tag an id for future reference.
● Android:layout_width (Required*)
○ Specifies the width or breadth of your 2D design component.
● Android:layout_height (Required*)
○ Specifies the height or length of your 2D design component.
● Android:text
○ Specifies the text you wish to show in a View.
○ For Example;
■ Using a TextView to display a name
■ Using a Button to display Ok or Cancel.
● Tools
○ Connects your layout file with your Java file.
Attributes Values
Android:layout_width, Android:layout_height
● match_parent: To match the size of your component or view with your parent layout or
ViewGroup.
● wrap_content: To match the size of your component or view with the size of its content.
○ This value will decrease in small screens and increase in larger screens.
XML tags for Android
TextView
Button
ImageView or
ImageButton
EditText
More Attributes
Relative Layout
● As the word suggests you make a relationship with the child components or views.
● Android RelativeLayout enables you to specify how child views are positioned relative to each
other.
● The position of each view can be specified as relative to sibling elements or relative to the
parent.
○ Android:layout_alignParentLeft= “true”
○ Android:layout_alignParentBottom= “true”
○ Android:layout_alignParentTop= “true”
More positions for the child elements
Android:layout_centerInParent= “true”
Android:layout_toRightOf= “@+id/btnStartApp”
Android:layout_toLeftOf= “@+id/btnStartApp”
Android:layout_above= “@+id/btnStartApp”
Android:layout_below= “@+id/btnStartApp”
Android:orientation = “vertical”
Android:gravity = “center”
Android:background = “@colors/Darkred”
Android:textColor = “@colors/Darkgray”
folder.
colors.xml file.
color property.
● To choose from a color picker instead, mention any hexcode then click on the color box that
● To add an icon:
Android:contentDescription = “<Yourtexthere>”
Android:scaleType = “fitXY”
● Save a string in the strings.xml file in your values sub-folder in res folder to use them later
in the app.
Android:inputType = “text”
● To set the spaces between your content and the border of your widget element.
Android:margin = “5dp”
Android:border = “2dp”
• https://andersenlab.com/services/design-studio/mobile-design?utm_source=google&utm_medium=cpc&utm
_campaign=service-ui-ux&utm_id=10209014361&utm_content=131327570812-539615780159-android%2
0ui%20design&gclid=CjwKCAiA3pugBhAwEiwAWFzwdewJlNU0IBVp1tmbT1WYPxqSVVBNKy_Ze1
AgaBxYyqOnMqwe1BZsDhoCCAYQAvD_BwE
• https://data-flair.training/blogs/android-layout-and-views/
• https://developer.android.com/develop/ui/views/layout/declaring-layout
• https://www.tutorialspoint.com/android/android_user_interface_layouts.htm
• https://developer.android.com/develop/ui/views/layout/relative
Handouts
• https://developer.android.com/develop/ui/views/layout/linear
• https://www.tutorialspoint.com/android/android_linear_layout.htm
• https://developer.android.com/reference/android/widget/ImageView
• https://www.geeksforgeeks.org/imageview-in-android-with-example/
• https://developer.android.com/reference/android/graphics/Color
• https://developer.android.com/guide/topics/resources/string-resource
• https://developer.android.com/reference/android/widget/EditText
• https://guides.codepath.com/android/Working-with-the-EditText
• https://www.geeksforgeeks.org/concept-of-padding-in-android/
• https://www.geeksforgeeks.org/concept-of-margin-in-android/
• https://www.tutorialspoint.com/how-do-i-put-a-border-around-an-android-textview