Android 中未显示主要 Activity
我在 Android 中有一个应用程序,我更改了主 Activity,现在启动它时什么也没有显示。我不知道出了什么问题。请帮忙。
Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<Button
android:id="@+id/btnCrash"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btnCrash"
/>
</LinearLayout>
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest package="gdpTesis.client" android:versionCode="1"
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:name="gdpTesis.client.main.GdpTesisApplication">
<activity android:name=".main.GdpTesisMainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
活动
package gdpTesis.client.main;
import gdpTesis.client.R;
import android.app.Activity;
import android.os.Bundle;
public class GdpTesisMainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
I have an application in Android, I've changed the main Activity, and now nothing is showing up when I launch it. I don't know what could be wrong. Please help.
Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<Button
android:id="@+id/btnCrash"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btnCrash"
/>
</LinearLayout>
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest package="gdpTesis.client" android:versionCode="1"
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:name="gdpTesis.client.main.GdpTesisApplication">
<activity android:name=".main.GdpTesisMainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The Activity
package gdpTesis.client.main;
import gdpTesis.client.R;
import android.app.Activity;
import android.os.Bundle;
public class GdpTesisMainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不完全理解你的命名约定。 Activity 包和名称是
Manifest 包和名称是
我不明白是否需要
考虑:
Activity
Manifest
并删除 Manifest 应用程序名称并导入 gdpTesis.client.R
I do not fully understand your naming conventions. The Activity package and name is
The Manifest package and name is
I do not understand the need for
Consider:
Activity
Manifest
and delete the Manifest Application name and import gdpTesis.client.R
我简直不敢相信!我使用模拟器,并且没有Android手机,所以我期望运行应用程序后,在模拟器屏幕中看到它,但它被锁定,并且它不会自行解锁,所以只需解锁它用鼠标...显示活动。对不起!谢谢!
I CAN'T BELIEVE IT! I'm with the emulator, and I don't have an Android phone, so I expected after running the application, see it in the emulator screen, but it was locked, and it doesn't unlock by itself, so just unlocking it with the mouse...showed the activity. sorry! and thanks!