SlideShare una empresa de Scribd logo
1 de 14
Create New Layout
ANDROID MOBILE APPLICATION
TRAINING VIDEO - 2
Copyright © 2020 Transpose Solutions. All Rights Reserved.
OVERVIEW
In this tutorial, we will learn how to open
an exisiting android project and make
changes to the exisiting layout and add new
widgets.
Copyright © 2020 Transpose Solutions. All Rights Reserved.
WHAT IS A LAYOUT
Android app user interface (UI) is that, user can see and interact with. Android app is built as a hierarchy of
layouts and widgets.
The layouts are ViewGroup objects, containers that control how their child views are positioned on the screen.
Widgets are View objects, UI components such as buttons and text boxes.
Android Studio default setting for the Main Activity (app > res > layout > activity_main.xml) is Constraint
Layout. If required, you can change the layout which is more suitable to your project requirement. Following are
the types of layout available to build a responsive user interface:
Constraint Layout
Linear Layout
Relative Layout
Frame Layout
Note: For more technical documents about User interface and Navigation can be accessed from Google
developer guide: https://developer.android.com/guide/topics/ui
Copyright © 2020 Transpose Solutions. All Rights Reserved.
OPEN AN EXISTING PROJECT
From your task bar/start menu, click open “Android
Studio”
In the Welcome to Android Studio window:
 Click Open an existing Android Studio project.
In the Open File or Project window:
 Go to Android Studio Projects Folder and Select My Mobile App – the project
we created in our earlier tutorial – “build your first app” and click OK.
Note: If you have not viewed our earlier tutorial – build your first app, please
view that before starting this tutorial.
Copyright © 2020 Transpose Solutions. All Rights Reserved.
OPEN - LAYOUT EDITOR
Android studio main window appears after some processes. Please follow the
following steps to get into the layout editor mode:
How to open the layout editor:
In the Project window, open app > res > layout > activity_main.xml.
If your editor shows the XML source, click the Design tab.
Click Select Design Surface and select Blueprint.
Click Show in the Layout Editor toolbar and make sure that Show All Constraints is checked.
Make sure Autoconnect is off. A tooltip in the toolbar displays Enable Autoconnection to Parent when
Autoconnect is off.
Click Default Margins in the toolbar and select your margin to “8”. If needed, you can adjust the margins for
each view later.
Click Device for Preview in the toolbar and select 5.5, 1440 × 2560, 560 dpi (Pixel XL)..
Note: This training material uses Android Studio v3.6.1.
Copyright © 2020 Transpose Solutions. All Rights Reserved.
ADD WIDGETS
Let us remove the exisiting TextView in the layout and add a new EditText control:
Select the TextView and then press delete.
In the Palette panel, select Plain Text Widget and drag and drop it near the top of
the layout. This is an EditText control that accepts plain text input.
Click and hold the anchor on the top side, drag it up until it snaps to the top of the
layout, and then release it. That's a constraint: it constrains the view within the default
margin that was set. In the case, we set it to 8 dp from the top of the layout.
Use the same process to create a constraint from the left side of the view to the left
side of the layout.
Copyright © 2020 Transpose Solutions. All Rights Reserved.
ADD A BUTTON
Let us add a Button next to the Edit Text control we just added in the layout:
From Palette panel, click Button Widget and drag the Button into the design editor
and drop it near the right side.
Create a constraint from the left side of the button to the right side of the text box.
To constrain the views in a horizontal alignment, create a constraint between the text
baselines. To do so, right-click the button and then select Show Baseline ab. The
baseline anchor appears inside the button. Click and hold this anchor, and then drag it
to the baseline anchor that appears in the adjacent text box.
Copyright © 2020 Transpose Solutions. All Rights Reserved.
UI STRINGS
A string resource provides text strings for your android mobile application with optional
text styling and formatting.
There are three types of resources that can provide your app with strings:
String: XML resource that provides a single string.
String Array: XML resource that provides an array of strings.
Quantity Strings (Plurals): XML resource that carries different strings for
pluralization.
Note: For more technical documents about String resources can be accessed from
Google developer guide: https://developer.android.com/guide/topics/resources/string-
resource
Copyright © 2020 Transpose Solutions. All Rights Reserved.
ADD NEW STRINGS
Let us add a new UI strings to our project, so that we can use those new strings to replace
the default values set in the Button and Edit Text control we just added in the layout. To
add new UI strings:
Open the Project window and then open app > res > values > strings.xml.
Click Open editor at the top of the window.
Click Add Key + to create a new string
Steps to add new string key: user_Input
Enter “user_input" in the Key field.
Enter "Enter your name" in the Default Value field.
Click OK.
Steps to add new string key: user_submit
Enter “user_submit" in the Key field.
Enter “Submit" in the Default Value field.
Click OK.
Copyright © 2020 Transpose Solutions. All Rights Reserved.
ASSIGN NEW STRINGS
Let us replace the default values set in the Button and Edit Text control in
the layout with one we just created:
Click the activity_main.xml in the tab bar
Click the EditText control in the layout.
Click “Attributes” on the right sidebar
Locate the text property, which is currently set to “Name”, and delete the value
Locate the hint property and then click pick a resource select “user_input” from
the list.
Click the button control in the layout.
Click “Attributes” on the right sidebar
Locate the text property, which is currently set to “button”.
Then click pick a resource select “user_submit”.
Copyright © 2020 Transpose Solutions. All Rights Reserved.
RESPONSIVE UI
Let us create a layout that’s responsive to different screen sizes, for that
we need to make the EditText control stretch to fill all the horizontal space
that remains after the button and margins are accounted for.
Before you continue, click Select Design Surface in the toolbar and select
Blueprint.
Select both EditText control and Button Control:
Click the EditText control in the layout, then click the Button control, then right-
click select Chains>Create Horizontal Chain.
Select the Button Control and open Attributes. Then set the right margin to 8
dp.
Click the EditText control to view its attributes. Then, click the width indicator
twice so it's set to Match Constraints
Copyright © 2020 Transpose Solutions. All Rights Reserved.
ADD STYLES AND THEMES
Styles and themes on Android allow you to separate the details of your
app design from the UI structure and behavior, similar to stylesheets in
web design.
Styles and themes are declared in a style resource file in res/values/,
usually named styles.xml.
A theme are declared with the android:theme attribute on either the
<application> tag or an <activity> tag in the AndroidManifest.xml file.
We can make changes to the Widgets look and feel by applying changes
to XML attributes values.
Note: For more technical documents about styles and themes can be accessed from Google
developer guide: https://developer.android.com/guide/topics/ui/look-and-feel/themes
Copyright © 2020 Transpose Solutions. All Rights Reserved.
RUN YOUR APP
Use Android studio emulator to run your app:
In the toolbar, select your app from the run/debug configurations drop-down
menu.
 From the target device drop-down menu, select the AVD that you want to run
your app on.
 Click Run
Android Studio installs the app on the AVD and starts the
emulator.
Copyright © 2020 Transpose Solutions. All Rights Reserved.
Thank you for watching the video!
Try our next training video - 3 to learn
- how to create new activity and send
user input from one activity to
another.
Copyright © 2020 Transpose Solutions. All Rights Reserved.

Más contenido relacionado

La actualidad más candente

Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User InterfaceMarko Gargenta
 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdfmurad3003
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAhsanul Karim
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outletsveeracynixit
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Write an application that draws basic graphical primitives.pptx
Write an application that draws basic graphical primitives.pptxWrite an application that draws basic graphical primitives.pptx
Write an application that draws basic graphical primitives.pptxvishal choudhary
 
Exercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callExercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callmaamir farooq
 
Android Application that makes use of RSS Feed.pptx
Android Application that makes use of RSS Feed.pptxAndroid Application that makes use of RSS Feed.pptx
Android Application that makes use of RSS Feed.pptxvishal choudhary
 
Chapter 07
Chapter 07Chapter 07
Chapter 07llmeade
 
I phone first app ducat
I phone first app ducatI phone first app ducat
I phone first app ducatPragati Singh
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layoutKrazy Koder
 
MDC - Material Design Components & Theming
MDC - Material Design Components & ThemingMDC - Material Design Components & Theming
MDC - Material Design Components & Themingharintrivedi
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Designfrancopw
 
View groups containers
View groups containersView groups containers
View groups containersMani Selvaraj
 

La actualidad más candente (19)

Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
 
Marakana Android User Interface
Marakana Android User InterfaceMarakana Android User Interface
Marakana Android User Interface
 
Create yourfirstandroidapppdf
Create yourfirstandroidapppdfCreate yourfirstandroidapppdf
Create yourfirstandroidapppdf
 
Android Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver TutorialAndroid Application Component: BroadcastReceiver Tutorial
Android Application Component: BroadcastReceiver Tutorial
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outlets
 
android layouts
android layoutsandroid layouts
android layouts
 
Write an application that draws basic graphical primitives.pptx
Write an application that draws basic graphical primitives.pptxWrite an application that draws basic graphical primitives.pptx
Write an application that draws basic graphical primitives.pptx
 
Android Widget
Android WidgetAndroid Widget
Android Widget
 
Exercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callExercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone call
 
Android Application that makes use of RSS Feed.pptx
Android Application that makes use of RSS Feed.pptxAndroid Application that makes use of RSS Feed.pptx
Android Application that makes use of RSS Feed.pptx
 
Android Intent.pptx
Android Intent.pptxAndroid Intent.pptx
Android Intent.pptx
 
Android development part 2
Android development part 2Android development part 2
Android development part 2
 
Chapter 07
Chapter 07Chapter 07
Chapter 07
 
I phone first app ducat
I phone first app ducatI phone first app ducat
I phone first app ducat
 
Android ui layout
Android ui layoutAndroid ui layout
Android ui layout
 
MDC - Material Design Components & Theming
MDC - Material Design Components & ThemingMDC - Material Design Components & Theming
MDC - Material Design Components & Theming
 
Presentation
PresentationPresentation
Presentation
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
 
View groups containers
View groups containersView groups containers
View groups containers
 

Similar a Create New Android Layout

Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidDenis Minja
 
Design for charms & contracts
Design for charms & contractsDesign for charms & contracts
Design for charms & contractsMaria Nasioti
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAhsanul Karim
 
Android User Interface: Basic Form Widgets
Android User Interface: Basic Form WidgetsAndroid User Interface: Basic Form Widgets
Android User Interface: Basic Form WidgetsAhsanul Karim
 
IOS Swift language 1st Tutorial
IOS Swift language 1st TutorialIOS Swift language 1st Tutorial
IOS Swift language 1st TutorialHassan A-j
 
Android Application Development - Level 1
Android Application Development - Level 1Android Application Development - Level 1
Android Application Development - Level 1Isham Rashik
 
How to create ui using droid draw
How to create ui using droid drawHow to create ui using droid draw
How to create ui using droid drawinfo_zybotech
 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculatorVlad Kolesnyk
 
Building a simple user interface lesson2
Building a simple user interface lesson2Building a simple user interface lesson2
Building a simple user interface lesson2Kalluri Vinay Reddy
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outletsveeracynixit
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Ahsanul Karim
 
Visual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th classVisual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th classmnewg218
 
App Inventor : Getting Started Guide
App Inventor : Getting Started GuideApp Inventor : Getting Started Guide
App Inventor : Getting Started GuideVasilis Drimtzias
 
App inventor week4(technovation)
App inventor week4(technovation)App inventor week4(technovation)
App inventor week4(technovation)than sare
 

Similar a Create New Android Layout (20)

Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 
Design for charms & contracts
Design for charms & contractsDesign for charms & contracts
Design for charms & contracts
 
Android development part 2
Android development part 2Android development part 2
Android development part 2
 
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & SpinnerAndroid User Interface Tutorial: DatePicker, TimePicker & Spinner
Android User Interface Tutorial: DatePicker, TimePicker & Spinner
 
Android User Interface: Basic Form Widgets
Android User Interface: Basic Form WidgetsAndroid User Interface: Basic Form Widgets
Android User Interface: Basic Form Widgets
 
Ap quiz app
Ap quiz appAp quiz app
Ap quiz app
 
IOS Swift language 1st Tutorial
IOS Swift language 1st TutorialIOS Swift language 1st Tutorial
IOS Swift language 1st Tutorial
 
Android ui with xml
Android ui with xmlAndroid ui with xml
Android ui with xml
 
Visual basic
Visual basicVisual basic
Visual basic
 
Android Application Development - Level 1
Android Application Development - Level 1Android Application Development - Level 1
Android Application Development - Level 1
 
How to create ui using droid draw
How to create ui using droid drawHow to create ui using droid draw
How to create ui using droid draw
 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculator
 
Building a simple user interface lesson2
Building a simple user interface lesson2Building a simple user interface lesson2
Building a simple user interface lesson2
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outlets
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]
 
Android app development guide for freshers by ace web academy
Android app development guide for freshers  by ace web academyAndroid app development guide for freshers  by ace web academy
Android app development guide for freshers by ace web academy
 
Visual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th classVisual programming basic.ppt bs cs5th class
Visual programming basic.ppt bs cs5th class
 
App Inventor : Getting Started Guide
App Inventor : Getting Started GuideApp Inventor : Getting Started Guide
App Inventor : Getting Started Guide
 
Neha
NehaNeha
Neha
 
App inventor week4(technovation)
App inventor week4(technovation)App inventor week4(technovation)
App inventor week4(technovation)
 

Último

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 

Último (20)

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 

Create New Android Layout

  • 1. Create New Layout ANDROID MOBILE APPLICATION TRAINING VIDEO - 2 Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 2. OVERVIEW In this tutorial, we will learn how to open an exisiting android project and make changes to the exisiting layout and add new widgets. Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 3. WHAT IS A LAYOUT Android app user interface (UI) is that, user can see and interact with. Android app is built as a hierarchy of layouts and widgets. The layouts are ViewGroup objects, containers that control how their child views are positioned on the screen. Widgets are View objects, UI components such as buttons and text boxes. Android Studio default setting for the Main Activity (app > res > layout > activity_main.xml) is Constraint Layout. If required, you can change the layout which is more suitable to your project requirement. Following are the types of layout available to build a responsive user interface: Constraint Layout Linear Layout Relative Layout Frame Layout Note: For more technical documents about User interface and Navigation can be accessed from Google developer guide: https://developer.android.com/guide/topics/ui Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 4. OPEN AN EXISTING PROJECT From your task bar/start menu, click open “Android Studio” In the Welcome to Android Studio window:  Click Open an existing Android Studio project. In the Open File or Project window:  Go to Android Studio Projects Folder and Select My Mobile App – the project we created in our earlier tutorial – “build your first app” and click OK. Note: If you have not viewed our earlier tutorial – build your first app, please view that before starting this tutorial. Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 5. OPEN - LAYOUT EDITOR Android studio main window appears after some processes. Please follow the following steps to get into the layout editor mode: How to open the layout editor: In the Project window, open app > res > layout > activity_main.xml. If your editor shows the XML source, click the Design tab. Click Select Design Surface and select Blueprint. Click Show in the Layout Editor toolbar and make sure that Show All Constraints is checked. Make sure Autoconnect is off. A tooltip in the toolbar displays Enable Autoconnection to Parent when Autoconnect is off. Click Default Margins in the toolbar and select your margin to “8”. If needed, you can adjust the margins for each view later. Click Device for Preview in the toolbar and select 5.5, 1440 × 2560, 560 dpi (Pixel XL).. Note: This training material uses Android Studio v3.6.1. Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 6. ADD WIDGETS Let us remove the exisiting TextView in the layout and add a new EditText control: Select the TextView and then press delete. In the Palette panel, select Plain Text Widget and drag and drop it near the top of the layout. This is an EditText control that accepts plain text input. Click and hold the anchor on the top side, drag it up until it snaps to the top of the layout, and then release it. That's a constraint: it constrains the view within the default margin that was set. In the case, we set it to 8 dp from the top of the layout. Use the same process to create a constraint from the left side of the view to the left side of the layout. Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 7. ADD A BUTTON Let us add a Button next to the Edit Text control we just added in the layout: From Palette panel, click Button Widget and drag the Button into the design editor and drop it near the right side. Create a constraint from the left side of the button to the right side of the text box. To constrain the views in a horizontal alignment, create a constraint between the text baselines. To do so, right-click the button and then select Show Baseline ab. The baseline anchor appears inside the button. Click and hold this anchor, and then drag it to the baseline anchor that appears in the adjacent text box. Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 8. UI STRINGS A string resource provides text strings for your android mobile application with optional text styling and formatting. There are three types of resources that can provide your app with strings: String: XML resource that provides a single string. String Array: XML resource that provides an array of strings. Quantity Strings (Plurals): XML resource that carries different strings for pluralization. Note: For more technical documents about String resources can be accessed from Google developer guide: https://developer.android.com/guide/topics/resources/string- resource Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 9. ADD NEW STRINGS Let us add a new UI strings to our project, so that we can use those new strings to replace the default values set in the Button and Edit Text control we just added in the layout. To add new UI strings: Open the Project window and then open app > res > values > strings.xml. Click Open editor at the top of the window. Click Add Key + to create a new string Steps to add new string key: user_Input Enter “user_input" in the Key field. Enter "Enter your name" in the Default Value field. Click OK. Steps to add new string key: user_submit Enter “user_submit" in the Key field. Enter “Submit" in the Default Value field. Click OK. Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 10. ASSIGN NEW STRINGS Let us replace the default values set in the Button and Edit Text control in the layout with one we just created: Click the activity_main.xml in the tab bar Click the EditText control in the layout. Click “Attributes” on the right sidebar Locate the text property, which is currently set to “Name”, and delete the value Locate the hint property and then click pick a resource select “user_input” from the list. Click the button control in the layout. Click “Attributes” on the right sidebar Locate the text property, which is currently set to “button”. Then click pick a resource select “user_submit”. Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 11. RESPONSIVE UI Let us create a layout that’s responsive to different screen sizes, for that we need to make the EditText control stretch to fill all the horizontal space that remains after the button and margins are accounted for. Before you continue, click Select Design Surface in the toolbar and select Blueprint. Select both EditText control and Button Control: Click the EditText control in the layout, then click the Button control, then right- click select Chains>Create Horizontal Chain. Select the Button Control and open Attributes. Then set the right margin to 8 dp. Click the EditText control to view its attributes. Then, click the width indicator twice so it's set to Match Constraints Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 12. ADD STYLES AND THEMES Styles and themes on Android allow you to separate the details of your app design from the UI structure and behavior, similar to stylesheets in web design. Styles and themes are declared in a style resource file in res/values/, usually named styles.xml. A theme are declared with the android:theme attribute on either the <application> tag or an <activity> tag in the AndroidManifest.xml file. We can make changes to the Widgets look and feel by applying changes to XML attributes values. Note: For more technical documents about styles and themes can be accessed from Google developer guide: https://developer.android.com/guide/topics/ui/look-and-feel/themes Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 13. RUN YOUR APP Use Android studio emulator to run your app: In the toolbar, select your app from the run/debug configurations drop-down menu.  From the target device drop-down menu, select the AVD that you want to run your app on.  Click Run Android Studio installs the app on the AVD and starts the emulator. Copyright © 2020 Transpose Solutions. All Rights Reserved.
  • 14. Thank you for watching the video! Try our next training video - 3 to learn - how to create new activity and send user input from one activity to another. Copyright © 2020 Transpose Solutions. All Rights Reserved.