2014-09-23 77 views
-2

请帮助我新的Android应用程序,而我下面是Android开发者网站上的指导,但是当我要运行的代码IAM获取和错误“没有资源标识符发现对于属性layout_width ...线性布局错误资源的android:layout_width

这里是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"> 

<EditText android:id="@+id/edit_message" 
    android:Layout_weight="1" 
    android:Layout_width="wrap_content" 
    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" /> 

+3

其'layout'不'Layout' – Raghunandan 2014-09-23 09:00:21

+0

使用部份的android:layout_width = “WRAP_CONTENT” 作为@Raghunandan说 – 2014-09-23 09:01:49

+0

我认为有错字在'EditText'和'Button'。在小写字母中使用了'android:layout_width' – 2014-09-23 09:01:59

回答

-1
<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="wrap_content" 
    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/> 
+0

我已更改为小写字母,这是我现在得到的消息在此行中找到多个注释: \t - 错误:未找到包含属性“Layout_height”的资源标识 \t 'android' \t - 跟在根元素后面的文档中的标记必须很好 - \t组成。 \t - 错误:找不到包含属性'Layout_width'的资源标识符 \t'android' – ngoni 2014-09-23 09:13:18

1

XML是大小写敏感的,你有资本LS在你的代码,它应该是这样的:

<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="wrap_content" 
     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>