lolhuangjinbiao
2017-01-09 16:02小菜鸟级: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条回答
为你推荐
- spring mvc 整合hibernate 菜鸟级问题
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 0个回答
- 菜鸟问题:ASP.NET用EF建控制器时出现类型有错
- 图片
- class
- asp.net
- 1个回答
- c#渣渣菜鸟,跪求问题
- 跪求问题
- c#
- 6个回答
- 一堆关于c的小问题,望赐教
- c
- c语言
- 初学小白
- 菜鸟提问
- 6个回答
- 菜鸟提问:用mfc编写简单计算器
- mfc
- c++
- 4个回答
换一换