Java 当我按下我的程序,我得到一个空白屏幕

Java 当我按下我的程序,我得到一个空白屏幕,java,android,Java,Android,在进入chapter3_1.xml页面后,当我按下手机后退键时,页面会很好地显示出来,并转到上一个按钮。再按一次,就会有一个本不该出现的空白页。再按一次,你就回到原来的按钮。没有错误,没有崩溃 显示 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.th3ramr0d.ar670_1

在进入chapter3_1.xml页面后,当我按下手机后退键时,页面会很好地显示出来,并转到上一个按钮。再按一次,就会有一个本不该出现的空白页。再按一次,你就回到原来的按钮。没有错误,没有崩溃

显示

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.th3ramr0d.ar670_1quickreference"
 android:versionCode="1"
 android:versionName="1.0" >

 <uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="21" />

 <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainMenu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


    <activity
        android:name=".SubMenu1"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.th3ramr0d.ar670_1quickreference.SUBMENU1" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <activity
        android:name=".Chapter3"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.th3ramr0d.ar670_1quickreference.CHAPTER3" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <activity
        android:name=".Chapter3_1"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.th3ramr0d.ar670_1quickreference.CHAPTER3_1" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

 </application>

 </manifest>
子菜单1.java

 package com.th3ramr0d.ar670_1quickreference;

 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;

 public class SubMenu1 extends Activity{

 @Override
 protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.chapter3);

    Button btnChpt3 = (Button) findViewById(R.id.btnChpt3_1);
    btnChpt3.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            startActivity(new Intent("com.th3ramr0d.ar670_1quickreference.CHAPTER3_1"));
        }
    });
 }

 }
第3章java

 package com.th3ramr0d.ar670_1quickreference;

 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;

 public class Chapter3 extends Activity{

 @Override
 protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    startActivity(new Intent("com.th3ramr0d.ar670_1quickreference.SUBMENU1"));
 }

 }
第3章\u 1.java

 package com.th3ramr0d.ar670_1quickreference;

 import android.app.Activity;
 import android.os.Bundle;

 public class Chapter3_1 extends Activity{

 @Override
 protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.chapter3_1);
 }
 }
activity_main.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_height="match_parent"
 android:paddingBottom="@dimen/activity_vertical_margin"
 android:paddingLeft="@dimen/activity_horizontal_margin"
 android:paddingRight="@dimen/activity_horizontal_margin"
 android:paddingTop="@dimen/activity_vertical_margin"
 tools:context="com.th3ramr0d.ar670_1quickreference.MainActivity" >

 <Button
    android:id="@+id/btnChpt3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Chapter 3" />

 </LinearLayout>

第3.xml章

  <?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" >

 <Button
    android:id="@+id/btnChpt3_1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="fuckmylife" />

 </LinearLayout>

第3章_1.xml

 <?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" >

 <TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="This is the content of chapter 3_1"
    android:textAppearance="?android:attr/textAppearanceLarge" />

 </LinearLayout>

我认为您在应用程序中使用的是fragment。 当你按下片段时,你正在将它添加到后堆栈中,这就是为什么当你按下后退按钮时,它会显示一个空白屏幕,这是你正在显示片段视图的框架布局。 参考


我认为您在应用程序中使用的是fragment。 当你按下片段时,你正在将它添加到后堆栈中,这就是为什么当你按下后退按钮时,它会显示一个空白屏幕,这是你正在显示片段视图的框架布局。 参考


我认为您在应用程序中使用的是fragment。 当你按下片段时,你正在将它添加到后堆栈中,这就是为什么当你按下后退按钮时,它会显示一个空白屏幕,这是你正在显示片段视图的框架布局。 参考


我认为您在应用程序中使用的是fragment。 当你按下片段时,你正在将它添加到后堆栈中,这就是为什么当你按下后退按钮时,它会显示一个空白屏幕,这是你正在显示片段视图的框架布局。 参考


在您的清单中,在活动中,您应该如下设置父项:

  android:parentActivityName="com.some.myproject.ParentActivityToThisActivity"

但它不能与API 14一起工作,应使用API 15或最新的API 15。

在清单中,在活动中,您应如下设置父级:

  android:parentActivityName="com.some.myproject.ParentActivityToThisActivity"

但它不能与API 14一起工作,应使用API 15或最新的API 15。

在清单中,在活动中,您应如下设置父级:

  android:parentActivityName="com.some.myproject.ParentActivityToThisActivity"

但它不能与API 14一起工作,应使用API 15或最新的API 15。

在清单中,在活动中,您应如下设置父级:

  android:parentActivityName="com.some.myproject.ParentActivityToThisActivity"

但是它不能与API 14一起工作,应该使用API 15或最新的API 15。

所以基本上使用它来将每个活动设置为其相应的父活动?简而言之,是的。我使用这样的方法,它的工作。我记得,我对api 14的问题有过警告,但在我当前的项目中,我使用的是min api 15。在你的应用程序中,原因可能会有所不同,只是猜测而已,但它应该会有所帮助。所以基本上用它来将每个活动设置为其相应的父活动?简而言之,是的。我使用这样的方法,它的工作。我记得,我对api 14的问题有过警告,但在我当前的项目中,我使用的是min api 15。在你的应用程序中,原因可能会有所不同,只是猜测而已,但它应该会有所帮助。所以基本上用它来将每个活动设置为其相应的父活动?简而言之,是的。我使用这样的方法,它的工作。我记得,我对api 14的问题有过警告,但在我当前的项目中,我使用的是min api 15。在你的应用程序中,原因可能会有所不同,只是猜测而已,但它应该会有所帮助。所以基本上用它来将每个活动设置为其相应的父活动?简而言之,是的。我使用这样的方法,它的工作。我记得,我对api 14的问题有过警告,但在我当前的项目中,我使用的是min api 15。原因可能在你的应用程序中有所不同,只是猜测而已,但它应该会有所帮助。我认为我将坚持使用youtube教程,而不是试图学习一点知识,然后跳进成熟的项目中。非常感谢你的帮助!我想我会坚持使用youtube教程,而不是尝试学习一点知识,然后投入到成熟的项目中去。非常感谢你的帮助!我想我会坚持使用youtube教程,而不是尝试学习一点知识,然后投入到成熟的项目中去。非常感谢你的帮助!我想我会坚持使用youtube教程,而不是尝试学习一点知识,然后投入到成熟的项目中去。非常感谢你的帮助!