Book Image

Android Studio Essentials

By : Belén Cruz Zapata
Book Image

Android Studio Essentials

By: Belén Cruz Zapata

Overview of this book

<p>Android Studio is an IDE that is based on the JetBrains IntelliJ IDEA. It gives developers a unique platform to develop and debug Android apps using various developer tools. It has a wide array of features such as live layout facility, Gradle build support, and template-based wizards, which makes it a preferred choice for developers.</p> <p>Starting off with the basic installation and configuration of Android Studio, this book aids you in building a new project by helping you to create a custom launcher icon and guiding you to choose your activity. You then gain an insight on the additional tools provided in Android Studio, namely the Software Development Kit (SDK) Manager, Android Virtual Device (AVD) Manager, and Javadoc.</p> <p>Finally, it helps you to familiarize yourself with the Help section in Android Studio that enables you to search for the help you might require in different scenarios.</p>
Table of Contents (17 chapters)
Android Studio Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding components


Our main layout is a relative layout and contains a text view saying Hello world!. Now let's add a new component. The easiest way to do this is by using the graphical editor, so open the Design tab. Select a component and drag it into the layout preview; for example, navigate to the Person Name component in Text Fields and place it below the text view.

In the Component Tree view, there is now a new editText object. Keep the text field selected to examine its properties loaded in the Properties inspector. Let's change some of them and observe the differences in the layout preview and in the component tree:

  • layout:width: This option will adapt the width of the field to its content. Its current value is wrap_content. Change it to match_parent to adapt it to the parent layout width (the root relative layout).

  • hint: Type Enter your name as the hint of the field. The hint is a text shown when the field is empty to indicate the information that should be typed. As the field has...