Escolar Documentos
Profissional Documentos
Cultura Documentos
• Babbage's Bag
• History
• Swift's Spreadsheets
The next dialog box asks you to select the type of Activity you
• The Stone Tapes
want to create. Every Android app consists of at least one
• Professional Programmer
Activity - you can think of it as the basic unit of app
• eBooks
construction. We need to talk much more about Activities later
• Programmer Puzzles
but for the moment simply select a Blank Activity.
• Bargain Computer Books
• CodeBin
• I Programmer Weekly
search...
Search
Selecione o idioma
Powered by Tradutor
New Articles!
• ICT 1301 - A 1960's
Computer
• Web Components With X
-Tag
• A Programmer's Guide to
Scratch 2 Finally you have to give your Activity a name - for the moment
• Android Adventures - just accept the default of MainActivity.
Pickers
• Functional And
Dysfunctional
Programming
• Magic of Merging
• Merkles and Social
Engineering
• History of Computer
Languages - the classical
decade, 1950s
• Android Adventures -
Spinners And Pickers
http://www.i-programmer.info/programming/android/5887-android-adventures-gettin... 21/10/2013
Android Adventures - Getting Started With Android Studio Página 2 de 4
Popular Book
Reviews
• Beautiful Architecture:
Leading Thinkers Reveal
the Hidden Beauty in
Software Design
• Hello World! Computer
Programming for Kids
and Other Beginners
• Practical Raspberry Pi
• Beginning R: The
Statistical Programming
Language
• Algorithms in a Nutshell
• Programming: Principles
and Practice Using C++ The MainActivity.java file can be found in the src/main/java
• Android Apps Marketing directory and the Main_Activity.xml file can be found in
• The Ruby Programming src/main/res/layout directory. The src directory is from your point
Language of view where most of the construction of your app occurs so
• How We Test Software at make sure you know where it is. The src/main directory is where
Microsoft you keep the files concerning the main Activity and the Java
• Simply Javascript code goes in Java and the various resource files belong in res.
Anatomy Of An Activity
http://www.i-programmer.info/programming/android/5887-android-adventures-gettin... 21/10/2013
Android Adventures - Getting Started With Android Studio Página 3 de 4
Hello Designer
First the XML layout file. Double click on activity_main.xml file in
the Project tab and the file will open - but not as an XML file as
you might expect. What you see when you open a layout file is
the drag-and-drop layout designer.
This looks a little too much to take in when you first see it but
you will quickly get used to it.
On the left is a Palette of all of the components - buttons, text,
checkboxes and so on - that you can place on the design
surface.
In the middle is the design surface and this defaults to the
screen size and appearance of the Nexus 4. You can select
other devices to work with.
On the right you have the Component Tree which shows you the
structure of your layout - its the same as the nesting structure of
the XML file. Below the Component Tree you have the
Properties window that can be used to set the properties of any
component in the layout.
If you have used any drag-and-drop designer then this one will
be familiar to you. If you have struggled with the detailed layout
using a markup language be it HTML, XAML or XML then you
will like how easy the designer makes building and testing a UI.
In the case of our sample program the only component uses is a
single TextView already containing the text "Hello World". You
can modify the greeting text if you want to. Select the TextView
component and use the Properties window to find its Text
property. Change this to read "Hello Android World". Don't worry
about the form of the original entry starting with an @ and
looking complicated just type the string in as given.
You can use the designer to create any UI you care to and you
really don't have to get involved in the XML that corresponds to
the layout. The designer will automatically generate the XML
needed to create the layout for you and modify it as you change
the layout. If you really want to see the XML then all you have to
do is select the Text tab at the bottom of the designer window.
You should find it fairly easy to understand but leave it to the
designer to modify it.
We will return to the designer and the XML it generates later.
http://www.i-programmer.info/programming/android/5887-android-adventures-gettin... 21/10/2013
Android Adventures - Getting Started With Android Studio Página 4 de 4
Ver esta página em: português Traduzir Desativar para: inglês Opções ▼
Largest Collection of Android Apps. Save Data Cost. Try Mobogenie Now!
http://www.i-programmer.info/programming/android/5887-android-adventures-gettin... 21/10/2013