第一个Android应用程序未运行
我按照中的步骤进行操作,我的第一个Android应用程序未运行,android,eclipse,Android,Eclipse,我按照中的步骤进行操作,我的活动\u main.xml如下 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
活动\u main.xml
如下
<?xml version="1.0" encoding="utf-8"?>
<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="0dp"
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>
我已经定义了提示字符串
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">My First App</string>
<string name="edit_message">Enter a message</string>
<string name="button_send">Send</string>
<string name="title_activity_main">mainActivity</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
</resources>
我的第一个应用程序
输入消息
发送
主要活动
设置
你好,世界!
但当我点击run按钮时,它没有显示任何活动 在
MainActivity.java中插入代码了吗
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
您是否已将此代码放入AndroidManifest文件中
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="YourActivityname"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
不能从.xml文件运行Android应用程序,必须从.java文件运行。选择运行方式>Android应用程序。还应确保您已设置并准备好模拟器,或已连接并准备好在真实设备上运行。问题是什么?…对不起。请查看我更新的问题代码,否则无法help@Nitish请放入清单和java文件,有什么问题吗?