我是论坛的新手,刚刚开始学习Android应用开发.我正在阅读developer.android.com上的教程,并且已经遇到了编译错误.我在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
Run Code Online (Sandbox Code Playgroud)
这是我现在的activity_main.xml代码:
<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>
Run Code Online (Sandbox Code Playgroud)
它是否会抛出错误,因为wrap_content是一个不正确的语法,还是需要在其他地方声明?任何帮助将不胜感激如何解决或修复此问题.
谢谢!