Java 阻止活动打开的Android XML文件
我正在学习android,因此我编写了以下代码,用于学习ScrollView并在linearlayout中创建多个linearlayout。我创建了一个菜单来启动不同的活动,但问题是当我单击与此xml文件关联的类时,新类(活动)不会显示在屏幕上。问题可能是什么?我如何解决?代码如下:Java 阻止活动打开的Android XML文件,java,android,xml,eclipse,Java,Android,Xml,Eclipse,我正在学习android,因此我编写了以下代码,用于学习ScrollView并在linearlayout中创建多个linearlayout。我创建了一个菜单来启动不同的活动,但问题是当我单击与此xml文件关联的类时,新类(活动)不会显示在屏幕上。问题可能是什么?我如何解决?代码如下: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="100"
android:padding="25dp" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="30"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age" />
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email Address" />
<EditText
android:id="@+id/editText3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Subject" />
<EditText
android:id="@+id/editText4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Phone No." />
<EditText
android:id="@+id/editText5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your Message" />
<EditText
android:id="@+id/editText6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="40">
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="20dp"
android:text="Email" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="30"
android:orientation="vertical">
<AnalogClock
android:id="@+id/analogClock1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
您是否在AndroidManifest.xml中添加了活动?每个活动都需要添加到清单文件中 例如:
<activity android:name=".HelloGoogleMaps" android:label="@string/app_name"/>
你说的不出现是什么意思?你是不是离我很近?如果是,发布日志。您是否已将电子邮件活动添加到清单中?你的开始活动代码是什么?Holly f**k。我忘了。我的错。
<activity android:name=".HelloGoogleMaps" android:label="@string/app_name"/>