Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: String types not allowed (at 'layout_height' with value 'wrap content'). activity_main.xml

Tags:

java

android

xml

I am new to the forum and just started learning about Android app development. I was going through the tutorials at developer.android.com and already ran into an compiling error. I see these three errors on my activity_main.xml:

error: Error: String types not allowed (at 'layout_height' with value 'wrap content').  activity_main.xml   
error: Error: String types not allowed (at 'layout_width' with value 'wrap content').   activity_main.xml   
error: Error: String types not allowed (at 'layout_height' with value 'wrap content').  activity_main.xml

and here is my activity_main.xml code as of now:

<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"
    tools:context=".MainActivity" >

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

Is it throwing an error because wrap_content is an incorrect syntax or does it need to be declared elsewhere? Any help will be appreciated on how to troubleshoot or fix this.

Thanks!

like image 504
TheOrangeRemix Avatar asked Dec 06 '22 06:12

TheOrangeRemix


1 Answers

I've just started learning myself. I believe the problem is missing underscores. It should read "wrap_content" not "wrap content".

like image 107
Glenn Avatar answered Feb 23 '23 00:02

Glenn