YouSub
Untitled

en English

Untitled English subtitles

0 downloads · 109 lines · added Nov 8, 2015

Report a problem
What's wrong?
Advertisement

English transcript

When you started programming, you used the XML visualizer.
The things you can do in the visualizer, you can also do in Android Studio and
a lot, lot, lot more.
As such, Android Studio might look a little bit complicated.
But to start making a application,
you actually only need to know a few of the core functionalities.
So really don't worry if you don't know what every single button does.
I still look things up, and
I sure don't know what every single button in Android Studio does.
Okay, I'm going to go down here and click the Text tab.
Looking at this middle part of the screen, I want you to think of this as
being something similar to a document editor such as Google Docs.
In Google Docs, you open a file, and you edit that file.
In Android Studio, you open a project which contains many files, and
you can edit any of the files within the project.
If we go over here to the left-hand side, we can see all the folders and
files that are inside of our project.
If I go over to a folder and click it, it shows me the sub-folders.
If I double-click a file, it opens a tab for that file.
Here's where you could edit the file.
And the tabs across are for switching back and forth between different files.
I'm going to go ahead and
close this file that I just opened by clicking the little x up here.
As you're editing things in Android Studio,
it does the work of automatically saving your work.
Now if I do something really disastrous, like whoops,
I accidentally select all this and then delete it,
always remember that you can undo and redo in Android Studio.
I'm going to undo that by going up here to the menu bar, and
clicking Edit > Undo.
And you can see right below it that we have Redo.
Alternatively, if you don't want to use the menu bar,
you can use the keyboard shortcut Ctrl+Z, or on Macs, Cmd+Z.
And to redo, it's Cmd+Shift+Z or Ctrl+Shift+Z.
Let's take a closer look at the left-hand side here.
Everything here combined makes up your app.
An app or an application on Android isn't a single file.
It's a collection of images, layouts, and other code.
Note that if you go up here,
you can select a few different ways to view the files and folders in your app.
Project, in particular,
shows you what the folders actually look like on your computer.
I'll click down a bit so you can see.
All right, not to scare you, but when you made your app there's actually a ton
of folders and files that were generated for you.
To simplify things, I usually just stick with the Android view which is a little
easier to navigate.
Now back when you made your project,
you chose where the project was going to be saved.
If you ever forget, you can look up here at the menu bar,
which reminds you where your project is saved.
And if you're feeling particularly brave, you should feel free to even take
a peek at what this folder structure actually looks like on your computer.
For example, on a Mac machine,
I could go to my home folder > Android Studio Projects.
And then I see this HappyBirthday folder,
and this contains all of the project files and folders for the application.
So if I were to delete this folder or move this folder,
it would really mess up things for Android Studio.
Okay, so what we're going to be working with is the activity_main.xml file.
It's located in the layout folder because it contains XML that has
the design or layout of your application.
I'm going to double-click.
Now the contents of this file should look pretty familiar.
It's very, very similar to the sort of XML that we were writing in the lesson.
One big difference are these two attributes here.
The xmlns attribute says that we're working with attributes that
are specific to Android development and making layouts.
XML is also used with websites, storing data, and other applications.
So we use this xmlns attribute to specify that we're making things
particularly for Android development and particularly for layouts.
The fact that we use the word Android here is also the reason that we put
android: in front of all the attributes that we use.
If you'd like to learn a little bit more about the xmlns attribute,
you can check out the instructor notes.
The important thing to know is when you make a new application,
these two things will be automatically included.
And you should include them in any other layouts you make,
otherwise your application won't work.
All right, now down here, you're going to see two tabs, the Design tab and
the Text tab.
And the Text tab is actually the tab that you're usually going to be
working with.
Over here on the far right, you'll see that there's a button that says Preview.
If you click on it, it'll remove the picture of the phone,
and if you click on it again, it'll bring the picture of the phone back.
This is a preview of what your XML looks like on a phone.
It's very similar to the XML Visualizer.
I'm actually going to go ahead and change the text attribute here to say,
Goodbye World.
Now if you do this on your own machine and you zoom in here, let me do it now,
you should see that the text updated to say Goodbye World, pretty cool.
If you click on the Design tab, you'll see a drag and drop interface for
designing phone layouts.
So for example, I could drag things over into the application.
Over here in this area called Component Tree,
it's going to list all of the different views that I have.
If I click on a particular view, down here in Properties, it shows me
all of the different attributes or properties that I can change.
This list can be pretty helpful for discovering new layout properties.
Also, if you right-click on any of these properties,
such as this alignStart, it'll give you an option to see the documentation.
This design view is pretty helpful if you're trying to quickly build a layout.
But you get a lot more control over exactly where different elements go
if you understand and know how to write code.
Since we don't really need any of these additional options, and don't know what
a lot of them do yet, it's easier to just stick with the Text tab.
That concludes a quick tour of Android Studio.
Next, we'll work on running our first app.

Need subtitles from another video?