SlideShare a Scribd company logo
1 of 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" />

More Related Content

What's hot

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
 

What's hot (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
 

Viewers also liked (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
 
Услуги стадиона «Динамо»
Услуги стадиона «Динамо»Услуги стадиона «Динамо»
Услуги стадиона «Динамо»
 

Similar to 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
 

Similar to 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
 

More from 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
 

More from 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
 

Recently uploaded

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
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
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
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
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 

Recently uploaded (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
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
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
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
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
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
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 

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" />