SlideShare ist ein Scribd-Unternehmen logo
1 von 7
Very basic
Calculator
layout in
activity_main.
xml file.
Good thing is that layout
can be controlled by drug-
and-drop method. So just
click on “Hello World” and
you can simply delete it.
Then just drug into your app
four buttons (which will later
represent arithmetic
symbols)
Now by clicking on
activity_main.xml tab at
the bottom you will go into
the “code” of the layout.
Each button is represented
by opening and closing tag
<Button … />
And as parameters you can
change it's text, layout_width
and so on...
android:id sets name which
represents button in a java
file.
Now change text and id
parameters for each
button.
Like in the next slide.
Don't worry if your code is a bit
different.
Because of graphical relative
layout android:layout_... might
have different value
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="@+id/minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/plus"
android:layout_alignBottom="@+id/plus"
android:layout_alignParentRight="true"
android:layout_marginRight="67dp"
android:text="-" />
<Button
android:id="@+id/division"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/plus"
android:layout_below="@+id/plus"
android:layout_marginTop="47dp"
android:text="/" />
<Button
android:id="@+id/mult"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/division"
android:layout_alignBottom="@+id/division"
android:layout_alignLeft="@+id/minus"
android:text="*" />
<Button
android:id="@+id/plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="39dp"
android:text="+" />
</RelativeLayout>
Now change back to
Graphical Layout and
correct layout by drug and
drop if something doesn't
look beautiful enough.
From Form Widgets folder
drug and drop TextView.
(this field will be used to
show the answer)
And from Text Fields drug
and drop Plain Text.
(this will take two numbers
as input)
Now open activity_main.xml
and change id's
appropriately
<TextView
android:id="@+id/answer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/input1"
android:layout_below="@+id/input1"
android:layout_marginLeft="14dp"
android:layout_marginTop="27dp"
android:text="TextView" />
<EditText
android:id="@+id/input1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="22dp"
android:ems="10" >
</EditText>
<EditText
android:id="@+id/input2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/input1"
android:layout_alignParentTop="true"
android:ems="10" />

Weitere ähnliche Inhalte

Was ist angesagt?

Microsoft Office 2003 Creating Macros
Microsoft Office 2003 Creating MacrosMicrosoft Office 2003 Creating Macros
Microsoft Office 2003 Creating MacrosS Burks
 
How to make a result sheet of students using MS EXCEL
How to make a result sheet of students using MS EXCELHow to make a result sheet of students using MS EXCEL
How to make a result sheet of students using MS EXCELAnu Radha
 
Microsoft excel 2007 programme for effective tertiary institution result grading
Microsoft excel 2007 programme for effective tertiary institution result gradingMicrosoft excel 2007 programme for effective tertiary institution result grading
Microsoft excel 2007 programme for effective tertiary institution result gradingAlexander Decker
 
Fomatting Text Tips
Fomatting Text TipsFomatting Text Tips
Fomatting Text TipsEMAINT
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)Khaled Anaqwa
 
Excel Document Recovery to the Rescue
Excel Document Recovery to the RescueExcel Document Recovery to the Rescue
Excel Document Recovery to the RescueWiley
 
Learn Vba excel 2007
Learn Vba excel 2007Learn Vba excel 2007
Learn Vba excel 2007Steve Johnson
 
Dynamic Web Pages Ch 2 V1.0
Dynamic Web Pages Ch 2 V1.0Dynamic Web Pages Ch 2 V1.0
Dynamic Web Pages Ch 2 V1.0Cathie101
 
Customizing Forms
Customizing FormsCustomizing Forms
Customizing FormsEMAINT
 
How to add the windows calculator to the quick access toolbar in microsoft ex...
How to add the windows calculator to the quick access toolbar in microsoft ex...How to add the windows calculator to the quick access toolbar in microsoft ex...
How to add the windows calculator to the quick access toolbar in microsoft ex...Trường Tiền
 
Smart todolist
Smart todolistSmart todolist
Smart todolistAppSheet
 
Android android layouts
Android android layoutsAndroid android layouts
Android android layoutsperpetrotech
 
Getting Started with MS Access and Pivot Tables
Getting Started with MS Access and Pivot TablesGetting Started with MS Access and Pivot Tables
Getting Started with MS Access and Pivot TablesParth Acharya
 
Lesson 1 setting up excel environment
Lesson 1   setting up excel environmentLesson 1   setting up excel environment
Lesson 1 setting up excel environmentguevarra_2000
 

Was ist angesagt? (20)

Microsoft Office 2003 Creating Macros
Microsoft Office 2003 Creating MacrosMicrosoft Office 2003 Creating Macros
Microsoft Office 2003 Creating Macros
 
Excel ch10
Excel ch10Excel ch10
Excel ch10
 
How to make a result sheet of students using MS EXCEL
How to make a result sheet of students using MS EXCELHow to make a result sheet of students using MS EXCEL
How to make a result sheet of students using MS EXCEL
 
Toolbar
ToolbarToolbar
Toolbar
 
Forms and buttons
Forms and buttonsForms and buttons
Forms and buttons
 
Android development session 3 - layout
Android development   session 3 - layoutAndroid development   session 3 - layout
Android development session 3 - layout
 
Microsoft excel 2007 programme for effective tertiary institution result grading
Microsoft excel 2007 programme for effective tertiary institution result gradingMicrosoft excel 2007 programme for effective tertiary institution result grading
Microsoft excel 2007 programme for effective tertiary institution result grading
 
Oracle forms 6_i__1_
Oracle forms 6_i__1_Oracle forms 6_i__1_
Oracle forms 6_i__1_
 
Fomatting Text Tips
Fomatting Text TipsFomatting Text Tips
Fomatting Text Tips
 
Android Training (Android UI)
Android Training (Android UI)Android Training (Android UI)
Android Training (Android UI)
 
Excel Document Recovery to the Rescue
Excel Document Recovery to the RescueExcel Document Recovery to the Rescue
Excel Document Recovery to the Rescue
 
Vlookup example
Vlookup exampleVlookup example
Vlookup example
 
Learn Vba excel 2007
Learn Vba excel 2007Learn Vba excel 2007
Learn Vba excel 2007
 
Dynamic Web Pages Ch 2 V1.0
Dynamic Web Pages Ch 2 V1.0Dynamic Web Pages Ch 2 V1.0
Dynamic Web Pages Ch 2 V1.0
 
Customizing Forms
Customizing FormsCustomizing Forms
Customizing Forms
 
How to add the windows calculator to the quick access toolbar in microsoft ex...
How to add the windows calculator to the quick access toolbar in microsoft ex...How to add the windows calculator to the quick access toolbar in microsoft ex...
How to add the windows calculator to the quick access toolbar in microsoft ex...
 
Smart todolist
Smart todolistSmart todolist
Smart todolist
 
Android android layouts
Android android layoutsAndroid android layouts
Android android layouts
 
Getting Started with MS Access and Pivot Tables
Getting Started with MS Access and Pivot TablesGetting Started with MS Access and Pivot Tables
Getting Started with MS Access and Pivot Tables
 
Lesson 1 setting up excel environment
Lesson 1   setting up excel environmentLesson 1   setting up excel environment
Lesson 1 setting up excel environment
 

Andere mochten auch (20)

Yourprezi
YourpreziYourprezi
Yourprezi
 
Clink for Card Issuers
Clink for Card IssuersClink for Card Issuers
Clink for Card Issuers
 
HAINUTE BOTEZ
HAINUTE BOTEZHAINUTE BOTEZ
HAINUTE BOTEZ
 
Ebecm19
Ebecm19Ebecm19
Ebecm19
 
Teks Forum Hegemoni
Teks Forum HegemoniTeks Forum Hegemoni
Teks Forum Hegemoni
 
Android tutorials6 run_your_app
Android tutorials6 run_your_appAndroid tutorials6 run_your_app
Android tutorials6 run_your_app
 
就職活動は遅らせるべきか
就職活動は遅らせるべきか就職活動は遅らせるべきか
就職活動は遅らせるべきか
 
Mousedeer
Mousedeer Mousedeer
Mousedeer
 
Android tutorials8 todo_list
Android tutorials8 todo_listAndroid tutorials8 todo_list
Android tutorials8 todo_list
 
DOL model notice for exchange
DOL  model notice for exchangeDOL  model notice for exchange
DOL model notice for exchange
 
аттестация учителей
аттестация учителейаттестация учителей
аттестация учителей
 
Mobile andwebapps
Mobile andwebappsMobile andwebapps
Mobile andwebapps
 
Johnny prodcomimpex srl
Johnny prodcomimpex srlJohnny prodcomimpex srl
Johnny prodcomimpex srl
 
Yourprezi
YourpreziYourprezi
Yourprezi
 
How the cell phone work
How the cell phone workHow the cell phone work
How the cell phone work
 
Benefits 101 guide
Benefits 101 guideBenefits 101 guide
Benefits 101 guide
 
видеоэкскурсия в красный берег(полная)
видеоэкскурсия в красный берег(полная)видеоэкскурсия в красный берег(полная)
видеоэкскурсия в красный берег(полная)
 
HAINUTE BOTEZ
HAINUTE BOTEZ HAINUTE BOTEZ
HAINUTE BOTEZ
 
Imbracaminte copii
Imbracaminte copiiImbracaminte copii
Imbracaminte copii
 
Услуги стадиона «Динамо»
Услуги стадиона «Динамо»Услуги стадиона «Динамо»
Услуги стадиона «Динамо»
 

Ähnlich wie Android tutorials7 calculator_basiclayout

Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculatorVlad Kolesnyk
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in androidMahmudul Hasan
 
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
 
mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-TejamFandat
 
Dreamweaver cs6 step by step
Dreamweaver cs6 step by stepDreamweaver cs6 step by step
Dreamweaver cs6 step by stepzoran Jelinek
 
Android Homework for-july-19th-2015
Android Homework for-july-19th-2015Android Homework for-july-19th-2015
Android Homework for-july-19th-2015Rishi Kumar
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Android apps development
Android apps developmentAndroid apps development
Android apps developmentMonir Zzaman
 
View groups containers
View groups containersView groups containers
View groups containersMani Selvaraj
 
Rapid applications development update12-06-14
Rapid applications development update12-06-14Rapid applications development update12-06-14
Rapid applications development update12-06-14LennartF
 
Web app-la-jan-2
Web app-la-jan-2Web app-la-jan-2
Web app-la-jan-2Thinkful
 

Ähnlich wie Android tutorials7 calculator_basiclayout (20)

Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculator
 
Basics and different xml files used in android
Basics and different xml files used in androidBasics and different xml files used in android
Basics and different xml files used in android
 
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
 
mobile application development -unit-3-
mobile application development  -unit-3-mobile application development  -unit-3-
mobile application development -unit-3-
 
Create New Android Layout
Create New Android LayoutCreate New Android Layout
Create New Android Layout
 
Dreamweaver cs6 step by step
Dreamweaver cs6 step by stepDreamweaver cs6 step by step
Dreamweaver cs6 step by step
 
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
 
Android Homework for-july-19th-2015
Android Homework for-july-19th-2015Android Homework for-july-19th-2015
Android Homework for-july-19th-2015
 
android layouts
android layoutsandroid layouts
android layouts
 
Ap quiz app
Ap quiz appAp quiz app
Ap quiz app
 
Android xml-based layouts-chapter5
Android xml-based layouts-chapter5Android xml-based layouts-chapter5
Android xml-based layouts-chapter5
 
Android ui with xml
Android ui with xmlAndroid ui with xml
Android ui with xml
 
Android apps development
Android apps developmentAndroid apps development
Android apps development
 
View groups containers
View groups containersView groups containers
View groups containers
 
Deck 6-456 (1)
Deck 6-456 (1)Deck 6-456 (1)
Deck 6-456 (1)
 
Rapid applications development update12-06-14
Rapid applications development update12-06-14Rapid applications development update12-06-14
Rapid applications development update12-06-14
 
Android development part 2
Android development part 2Android development part 2
Android development part 2
 
Android development part 2
Android development part 2Android development part 2
Android development part 2
 
01 08 - graphical user interface - layouts
01  08 - graphical user interface - layouts01  08 - graphical user interface - layouts
01 08 - graphical user interface - layouts
 
Web app-la-jan-2
Web app-la-jan-2Web app-la-jan-2
Web app-la-jan-2
 

Mehr von Vlad Kolesnyk

Mech eng presentation
Mech eng presentationMech eng presentation
Mech eng presentationVlad Kolesnyk
 
Android tutorials7 calculator_intro
Android tutorials7 calculator_introAndroid tutorials7 calculator_intro
Android tutorials7 calculator_introVlad Kolesnyk
 
Android tutorials8 todo_list
Android tutorials8 todo_listAndroid tutorials8 todo_list
Android tutorials8 todo_listVlad Kolesnyk
 
Android tutorials2 android_tools_on_eclipse
Android tutorials2 android_tools_on_eclipseAndroid tutorials2 android_tools_on_eclipse
Android tutorials2 android_tools_on_eclipseVlad Kolesnyk
 
Android tutorials1 install_ide
Android tutorials1 install_ideAndroid tutorials1 install_ide
Android tutorials1 install_ideVlad Kolesnyk
 
Android tutorials7 calculator_packageexploirer
Android tutorials7 calculator_packageexploirerAndroid tutorials7 calculator_packageexploirer
Android tutorials7 calculator_packageexploirerVlad Kolesnyk
 
Android tutorials7 calculator_javaprogramming
Android tutorials7 calculator_javaprogrammingAndroid tutorials7 calculator_javaprogramming
Android tutorials7 calculator_javaprogrammingVlad Kolesnyk
 
Android tutorials7 calulator_improve
Android tutorials7 calulator_improveAndroid tutorials7 calulator_improve
Android tutorials7 calulator_improveVlad Kolesnyk
 

Mehr von Vlad Kolesnyk (9)

Mech eng presentation
Mech eng presentationMech eng presentation
Mech eng presentation
 
Android tutorials7 calculator_intro
Android tutorials7 calculator_introAndroid tutorials7 calculator_intro
Android tutorials7 calculator_intro
 
Android tutorials8 todo_list
Android tutorials8 todo_listAndroid tutorials8 todo_list
Android tutorials8 todo_list
 
Android tutorials2 android_tools_on_eclipse
Android tutorials2 android_tools_on_eclipseAndroid tutorials2 android_tools_on_eclipse
Android tutorials2 android_tools_on_eclipse
 
Android tutorials1 install_ide
Android tutorials1 install_ideAndroid tutorials1 install_ide
Android tutorials1 install_ide
 
Android tutorials7 calculator_packageexploirer
Android tutorials7 calculator_packageexploirerAndroid tutorials7 calculator_packageexploirer
Android tutorials7 calculator_packageexploirer
 
Android tutorials7 calculator_javaprogramming
Android tutorials7 calculator_javaprogrammingAndroid tutorials7 calculator_javaprogramming
Android tutorials7 calculator_javaprogramming
 
Android tutorials7 calulator_improve
Android tutorials7 calulator_improveAndroid tutorials7 calulator_improve
Android tutorials7 calulator_improve
 
Github tutorial1
Github tutorial1Github tutorial1
Github tutorial1
 

Kürzlich hochgeladen

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Kürzlich hochgeladen (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Android tutorials7 calculator_basiclayout

  • 2. Good thing is that layout can be controlled by drug- and-drop method. So just click on “Hello World” and you can simply delete it. Then just drug into your app four buttons (which will later represent arithmetic symbols)
  • 3. Now by clicking on activity_main.xml tab at the bottom you will go into the “code” of the layout. Each button is represented by opening and closing tag <Button … /> And as parameters you can change it's text, layout_width and so on... android:id sets name which represents button in a java file. Now change text and id parameters for each button. Like in the next slide.
  • 4. Don't worry if your code is a bit different. Because of graphical relative layout android:layout_... might have different value <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <Button android:id="@+id/minus" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/plus" android:layout_alignBottom="@+id/plus" android:layout_alignParentRight="true" android:layout_marginRight="67dp" android:text="-" /> <Button android:id="@+id/division" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/plus" android:layout_below="@+id/plus" android:layout_marginTop="47dp" android:text="/" /> <Button android:id="@+id/mult" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/division" android:layout_alignBottom="@+id/division" android:layout_alignLeft="@+id/minus" android:text="*" /> <Button android:id="@+id/plus" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:layout_marginLeft="39dp" android:text="+" /> </RelativeLayout>
  • 5. Now change back to Graphical Layout and correct layout by drug and drop if something doesn't look beautiful enough.
  • 6. From Form Widgets folder drug and drop TextView. (this field will be used to show the answer) And from Text Fields drug and drop Plain Text. (this will take two numbers as input)
  • 7. Now open activity_main.xml and change id's appropriately <TextView android:id="@+id/answer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/input1" android:layout_below="@+id/input1" android:layout_marginLeft="14dp" android:layout_marginTop="27dp" android:text="TextView" /> <EditText android:id="@+id/input1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="22dp" android:ems="10" > </EditText> <EditText android:id="@+id/input2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/input1" android:layout_alignParentTop="true" android:ems="10" />