androidandroid-layoutandroid-xml

Android studio .XML confusion with the book that is teaching me android development


I have just started my android journey with the help of a book. Which is not recommended but it is my preferred method of learning. In this book when I get to examine the layout file .xml the book says that this pre-made file starts and ends with

<RelativeLayout> ... </RelativeLayout>

but in the android manifest file I was given, I noticed the contents were similar but started and ended with a

<manifest> ... </manifest>

so are these two pieces of code the same, are they interchangeable, how can this confuse me in the future, and can this Error make the book I am using obsolete. (The book is called "Android Programming for Beginners" by John Horton)


Solution

  • Xml is a file type, and is used for several things in Android development.

    The AndroidManifest.xml file is the App's configuration xml file. It describes essential information about your app to the Android build tools, the Android operating system, and Google Play.
    It's used also to declare:

    The Layout files (.xml files also) are used to create the designs, you can use several tags according to your need inside those design.xml files:

    Examples of Android xml design tags:

    <RelativeLayout ... </RelativeLayout>
    <LinearLayout ... </LinearLayout>
    <FrameLayout ... </FrameLayout>
    <ScrollView ... </ScrollView>
    <TextView ... </TextView>
    <ImageView ... </ImageView>
    

    And many more...

    They are two different xml file so they are not interchangeable

    Regarding the book:
    I checked it, it's very good, but i think if you start with video tutorial first then go back to the book after 2 weeks you're gonna save a lot of time later and you will be able to understand the book better.

    Keep learning, Good luck