官术网_书友最值得收藏!

Creating our Hello World! program

So, let's create our first Hello World program. As you can see, you have a Palette in front of you besides the blue DUMMY CONTENT window. Simply drag and drop the TextView component onto your DUMMY CONTENT screen, as you can see in the following screenshot:

Dragging and dropping TextView component onto our screen

Notice the new Properties window when you successfully place TextView in the DUMMY CONTENT screen.

Now, you can see a blank Text View component on your screen, but there's nothing written on it. To have something written on it, we need to modify its properties a little. Check out the Properties on the right-hand side of the screen and, in the text component over there, type in Hello World!. Also, you can see that our text is very small. Let's change that to make it a little bigger so that it can be clearly visible to us. Locate the last option in the Properties window named textAppearance. Click on the drop-down menu next to it, and select any option that suits your choice from there. For this example, we will use AppCompat.Headline; however, you can choose whatever you want to. Once you are done with it, you will see something like this:

Your first Hello World! program is ready!

That's it! You are now ready to execute your program! Easy peasy, lemon squeezy, right? Let's move on to actually executing this code now. For this purpose, we will need to run something known as the Emulator. An emulator is simply a virtual device that will act as an Android device on your PC, so you don't have to actually test your app on an Android device every time. You will need to follow a few steps to set up an emulator, so let's get started with it. You will only have to set up the emulator once, and next time, it will be ready for you.

主站蜘蛛池模板: 海安县| 道孚县| 商城县| 石家庄市| 八宿县| 利辛县| 桃园县| 光山县| 松潘县| 库尔勒市| 兰西县| 凤山县| 龙川县| 江孜县| 无极县| 中阳县| 肇东市| 南阳市| 封丘县| 徐闻县| 嘉禾县| 宁乡县| 武宁县| 锡林浩特市| 灵山县| 剑阁县| 遵义县| 新沂市| 淮南市| 石楼县| 屏山县| 临武县| 宁城县| 那曲县| 濮阳市| 泊头市| 丽江市| 新兴县| 乌拉特前旗| 扎兰屯市| 临漳县|