1
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText android:id="@+id/edit_message"
    android:layout_weight="1"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message" />
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send" />
</LinearLayout>

From this (which is from the android tutorial) I am getting an error that The processing instruction target matching "[xX][mM][lL]" is not allowed (which is on the line starting

4 Answers4

3
  1. Put <?xml version="1.0" encoding="utf-8"?> on the top of the file
  2. Remove xmlns:android="http://schemas.android.com/apk/res/android" from LinearLayout
Nickolai Astashonok
  • 2,878
  • 3
  • 20
  • 23
1

Put on the top below line#

<?xml version="1.0" encoding="utf-8"?>

And remove from LinearLayout below line#

xmlns:android="http://schemas.android.com/apk/res/android"

For more info refer Stackoverflow Question

Community
  • 1
  • 1
RobinHood
  • 10,897
  • 4
  • 48
  • 97
0

I edited your layout. <?xml version="1.0" encoding="utf-8"?> this takes makes the problem:

Below layout correct:

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/edit_message"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:hint="@string/edit_message" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/button_send" />
    </LinearLayout>
Lokesh
  • 5,180
  • 4
  • 27
  • 42
0
<?xml version="1.0" encoding="utf-8"?>  
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context=".MainActivity" >
 <LinearLayout 
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="horizontal">
<EditText android:id="@+id/edit_message"
  android:layout_weight="1"
  android:layout_width="0dp"
  android:layout_height="wrap_content"
  android:hint="@string/edit_message" />
<Button
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="@string/button_send" />
</LinearLayout>
</RelativeLayout> 
Sanu
  • 455
  • 1
  • 6
  • 17