user3475057
user3475057

Reputation: 13

Can't figure out this android error

<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

Upvotes: 1

Views: 66

Answers (4)

Sanu
Sanu

Reputation: 455

<?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> 

Upvotes: 0

Lokesh
Lokesh

Reputation: 5368

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>

Upvotes: 0

RobinHood
RobinHood

Reputation: 10969

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

Upvotes: 1

Nickolai Astashonok
Nickolai Astashonok

Reputation: 2888

  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

Upvotes: 3

Related Questions