[英]My app not showing up on the app drawer
Heyy guys .. I'm doing a simple app with a splash screen plus frames animation for displaying gif on splash screen ... the thing is .. the apps` getting installed but not showing up on the app drawer this is the manifest. 嗨,大家好我正在做一个带有启动画面的简单应用,外加用于在启动画面上显示gif的帧动画...问题是..正在安装的应用但未出现在应用抽屉中,这是清单。 Basically its the Splash activity that i want to run first and then the main activity.
基本上是我要先运行的Splash活动,然后是主要活动。
<?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>
heres the Splash 飞溅
package com.example.placebo;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView;
public class Splash extends Activity {
@Override
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();
startActivity(new Intent(Splash.this,Main.class));
}
}
heres the animation xml 继承人动画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>
and the Main.java 和Main.java
package com.example.placebo;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Main extends Activity implements OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button b1= (Button) findViewById(R.id.button1);
b1.setOnClickListener(this);
Button b2= (Button) findViewById(R.id.button2);
b2.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v.getId()==R.id.button1) {
startActivity(new Intent(Main.this, WifiState.class));
}
if(v.getId()==R.id.button2) {
startActivity(new Intent(Main.this, ColorPlay.class));
}
}
}
change this to: 更改为:
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);
}
Try this. 尝试这个。
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);
}
You can just keep the drawable image as the background for activity_splash layout. 您可以仅将可绘制图像保留为activity_splash布局的背景。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.