Android emulator中没有我的应用程序的输出
我是android新手,所以我遇到了问题,我想创建一个文本框,我的代码如下 主xml文件:Android emulator中没有我的应用程序的输出,android,android-emulator,Android,Android Emulator,我是android新手,所以我遇到了问题,我想创建一个文本框,我的代码如下 主xml文件: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_hei
<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"
tools:context=".MainActivity" >
<EditText
android:id="@+id/mytextText"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<requestFocus />
</EditText>
</LinearLayout>
但我的模拟器中没有创建任何应用程序,我不明白,代码中没有错误,apk是lanching,但没有ouptut plz,请帮助我,可能是因为您可能没有在清单中声明您的活动为
启动器。
这就是为什么它刚刚安装而没有发布
在清单中将您的活动声明为启动器活动,如下所示:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
>
<activity
android:name=".MainActivity"
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>
改为
edittext = (EditText) findViewById(R.id.mytextText);
很可能会奏效
如果不工作,则重播在android清单文件中添加MainActivity类,然后选择编辑文本id引用,该引用在xml和java代码中应相同,然后仅在执行某些操作中。假设在xml编辑文本id mytext中,该引用在java类中应相同。现在运行应该启动的程序
edittext = (EditText) findViewById(R.id.mytextText);
edittext = (EditText) findViewById(R.id.menu_settings);
edittext = (EditText) findViewById(R.id.mytextText);