lolhuangjinbiao 2017-01-09 16:02 采纳率: 33.3%
浏览 850

小菜鸟级: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>


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

  • 写回答

5条回答 默认 最新

  • JE_GE 2017-01-09 16:10
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料