Phuc Le Tuan Phuc Le Tuan - 3 months ago 54
Android Question

Multiple root tags error Android

I am editing the

setting_main.xml
file of my project in Android Studio, and its giving the below error:

Multiple Root Tags


Code Block:

<AbsoluteLayout>
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RadioButton ... />
<RadioButton ... />

</RadioGroup>

<TextView ... />

<Button ... />

</AbsoluteLayout>

Answer

Try to edit setting_main.xml like this format:

<AbsoluteLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RadioGroup 
         ...>

        <RadioButton
             ...
             />

        <RadioButton
             ... 
             />
    </RadioGroup>

    <TextView
        ... />

    <Button
        ... />

</AbsoluteLayout>

Hope it helps.