Develop Android Apps, Tutorial main activity java
NEXT Page - Android App Coding - Res Values Strings.xml Tutorial
PREV Page

Goto - All Tutorials

Resources Layout Main xml Tutorial

res/layout/main.xml
To locate this file in your android app project files goto:
AppProject/nameOfApp/res/layout/main.xml
nameOfApp is the name you gave the app when creating the AppProject


This file is editable and you will use it often to create, add, change your apps layout. It is a xml file type; so it is easy to code.


This file contains the apps layout particulars, like: the margins, text color, text size, font type, color of the text links. You can also define your images and videos in this xml page.
As you view the image on this page, you can see each element mentioned has been added to the TextView for this app's layout. Most are self explanatory.

The code - Android:autoLink="Web", means that any links added to the textView page text will automatically be clickable or hyperlinked. For example, if we added androidappcoding.com, it would become clickable in your page view.

The code android:text="@string/mathintro", means there is a text string named mathintro, that contains the text you want shown on this pageview (textview). More info on strings in the next tutorial.

The code android:orientation="vertical", means that when your app launches, you want it to show vertically in the users tablet: usually it is vertically or horizontally.

The code, android:layout_MarginTop="10dp", means that is the space you want from the top of the screen to where your text or images first are shown in the page view. View all margin elements here

The code "LinearLayout" , refers to the type of Layout chosen for the TextView. There are several to choose from. Linear Layout is probably the most common.



Share This Page



AIDE for creating Android Apps on your tablet or cell phone(android).
Free and Paid - with Free.
GoTo Aide

ANDROID STUDIO - for creating Android Apps on your desktop computer.
Free to Install and Use

Learn more - Android Studio

The Java XML files we code(example tutorial codes) and the Android Apps we create in our Free Tutorials are compatible with Android Studio and AIDE. Just choose Java XML as your Programming Language.



You May Like:
Make Sushi Rolls Taste World Wines Flavours and Aromas
To Copy Code Use Mouse

This free script provided by
JavaScript Kit