小菜鸟级:Android创建和加载布局问题

照第一行代码敲的,发现根本不能运行,故来请教各位大神。
首先布局文件first_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<Button
    android:id="@+id/button_1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string Button 1" />


其次firstActivity.java中:
package com.example.activitytest;
import android.app.Activity;
import android.os.Bundle;

public class FirstActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.first_layout);
}

}
最后AndroidMainfest中:
package="com.example.activitytest"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="21" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/Button 1"
    android:theme="@style/AppTheme" >
    <activity
         android:name=".FirstActivity"
         android:label="This is FirstActivity" >
         <intent-filter>
             <action android:name="android.intent.action.MAIN" />
             <category android:name="android.intent.category.LAUNCHER"/>
         </intent-filter>
     </activity>   
</application>


代码如上,但却不能运行,错误怎么纠正呢?

具体什么异常啊,不是怎样排
多半是环境都没有搭建好

先clean一下项目 不行的话,发一下异常信息

难道就没人发现你的布局被吃了吗?

<?xml version="1.0" encoding="utf-8"?>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

把异常信息发出来看下,比较好判断问题根源

你好,首先说一下first_layout.xml,你没有提供完整的代码,或者可以说你在写代码时就没有写完整。其次是first_layout.xml中的Button按钮中的text文本是不允许你这么写的,不出意外会报错(No resource type specified (at 'text' with value '@string Button 1'))。
有两种改法:

  1. 删去"@string "
  2. 在"@string "和 "Button 1"之前加一个“/”