Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我的应用程序未显示在应用程序抽屉上_Java_Android_Xml - Fatal编程技术网

Java 我的应用程序未显示在应用程序抽屉上

Java 我的应用程序未显示在应用程序抽屉上,java,android,xml,Java,Android,Xml,嘿,伙计们。。我正在做一个简单的应用程序,有一个启动屏幕,加上在启动屏幕上显示gif的帧动画。。。事情是。。应用程序正在安装,但未显示在应用程序抽屉上 这是舱单。 基本上,这是我想首先运行的启动活动,然后是主要活动 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.

嘿,伙计们。。我正在做一个简单的应用程序,有一个启动屏幕,加上在启动屏幕上显示gif的帧动画。。。事情是。。应用程序正在安装,但未显示在应用程序抽屉上 这是舱单。 基本上,这是我想首先运行的启动活动,然后是主要活动

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

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="14" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.placebo.Main"
            android:label="@string/app_name" >

        </activity>
        <activity 
            android:name=".Splash"
            android:label="@string/app_name"
    >
            <intent-filter>
                <action android:name="android.intent.action.Splash" />

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

</manifest>
下面是动画xml

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/frame_000" android:duration="40"/>
    <item android:drawable="@drawable/frame_001" android:duration="40"/>
    <item android:drawable="@drawable/frame_002" android:duration="40"/>
    <item android:drawable="@drawable/frame_003" android:duration="40"/>
    <item android:drawable="@drawable/frame_004" android:duration="40"/>
    <item android:drawable="@drawable/frame_005" android:duration="40"/>
    <item android:drawable="@drawable/frame_006" android:duration="40"/>
    <item android:drawable="@drawable/frame_007" android:duration="40"/>
    <item android:drawable="@drawable/frame_008" android:duration="40"/>
    <item android:drawable="@drawable/frame_009" android:duration="40"/>
    <item android:drawable="@drawable/frame_010" android:duration="40"/>
    <item android:drawable="@drawable/frame_011" android:duration="40"/>
    <item android:drawable="@drawable/frame_012" android:duration="40"/>
    <item android:drawable="@drawable/frame_013" android:duration="40"/>
    <item android:drawable="@drawable/frame_014" android:duration="40"/>
    <item android:drawable="@drawable/frame_015" android:duration="40"/>
    <item android:drawable="@drawable/frame_016" android:duration="40"/>
    <item android:drawable="@drawable/frame_017" android:duration="40"/>
    <item android:drawable="@drawable/frame_018" android:duration="40"/>
    <item android:drawable="@drawable/frame_019" android:duration="40"/>

</animation-list>
将此更改为:

protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);
    ImageView iv = (ImageView) findViewById(R.id.iv1);
    iv.setBackgroundResource(R.animator.animation);
    AnimationDrawable anim = (AnimationDrawable) iv.getBackground();
    anim.start();
            new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
              startActivity(new Intent(Splash.this,Main.class));
        }
    }, 2000);

}
试试这个

private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    //To Delay by 3 Seconds
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            // This method will be executed once the timer is over
            // Start your app main activity
            Intent i = new Intent(Splash.this, MainActivity.class);
            startActivity(i);
            // close this activity
            finish();
        }
    }, SPLASH_TIME_OUT);

    }
您只需将可绘制图像作为活动_splash布局的背景即可

protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);
    ImageView iv = (ImageView) findViewById(R.id.iv1);
    iv.setBackgroundResource(R.animator.animation);
    AnimationDrawable anim = (AnimationDrawable) iv.getBackground();
    anim.start();
            new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
              startActivity(new Intent(Splash.this,Main.class));
        }
    }, 2000);

}
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    //To Delay by 3 Seconds
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            // This method will be executed once the timer is over
            // Start your app main activity
            Intent i = new Intent(Splash.this, MainActivity.class);
            startActivity(i);
            // close this activity
            finish();
        }
    }, SPLASH_TIME_OUT);

    }