why my splash screen don't show the images?

前端 未结 3 1447
-上瘾入骨i
-上瘾入骨i 2020-12-06 23:13

I\'ve created one splash screen with android studio 0.1, but when I test it on my phone(nexus s) in debugging mode with usb the image isn\'t show.. why?

this is the

3条回答
  •  难免孤独
    2020-12-07 00:18

    Try this code

    MainActivity

    public class MainActivity extends Activity {
    
    String EmpID;
    int requestCode;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.splash);          
        Thread timer = new Thread() {
            public void run() {
                try {
                    sleep(2500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                } finally {
                    startActivity(new Intent(getApplication(), Main.class));
                     MainActivity.this.finish();
                }
            }
        };
        timer.start();
       }
    }
    

    Splash.xml Remember splash image should be png

    
    
    

提交回复
热议问题