我創建了一個初始屏幕,但是當我啓動我的應用程序時,初始屏幕不顯示,只是一個黑色屏幕。不過,在啓動畫面的計時器結束後,我的菜單出現了。在我的splashscreen.xml的圖形佈局中,閃屏圖像顯示。但是運行時,它不會。一切都只是我的啓動畫面正常...android eclipse初始屏幕圖像不顯示
代碼myMain.java:
package com.immrroj.firstapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class myMain extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
Thread splashtimer = new Thread()
{
@Override
public void run()
{
try
{
int timer = 0;
while (timer < 5000)
{
sleep(100);
timer = timer + 100;
}
startActivity(new Intent("com.immrroj.firstapp.CLEARSCREEN"));
} catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
finish();
}
}
};
splashtimer.run();
}
@Override
protected void onDestroy()
{
// TODO Auto-generated method stub
super.onDestroy();
}
@Override
protected void onResume()
{
// TODO Auto-generated method stub
super.onResume();
}
@Override
protected void onStart()
{
// TODO Auto-generated method stub
super.onStart();
}
@Override
protected void onStop()
{
// TODO Auto-generated method stub
super.onStop();
}
}
代碼myMenu.java
package com.immrroj.firstapp;
import android.app.Activity;
import android.os.Bundle;
public class myMenu extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
代碼爲我的main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/mymenu">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PRESS ME!!"
android:textSize="19dp"
android:textStyle="bold"
android:width="200dp" android:layout_gravity="right"/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PRESS ME TOO!"
android:gravity="center"
android:textSize="19dp"
android:textStyle="bold" android:width="200dp" android:layout_gravity="right"/>
</LinearLayout>
我的splashscreen.xml代碼....圖像androidsplash沒有顯示
我的Android清單<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:src="@drawable/androidsplash"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
代碼:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.immrroj.firstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".myMain" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="@string/app_name"
android:name=".myMenu" >
<intent-filter >
<action android:name="com.immrroj.firstapp.CLEARSCREEN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
請help..although我可以繼續下去,那就真的竊聽我....
UPDATE: 好吧...我認爲它真的很難解決這個問題,但沒有手中的代碼...所以即時通訊發佈此鏈接,所以任何人都可以看到代碼和修補它...請幫助我...我wnat學習機器人,但我卡在這裏.. ..在這裏下載源代碼,這是安全的,我發誓:https://skydrive.live.com/redir.aspx?cid=79ecba5b079a1b4c&resid=79ECBA5B079A1B4C!293&parid=79ECBA5B079A1B4C!113&authkey=!AK8-cta_tThQUms
你可以把帶有一些文本的'TextView'放到你的splash xml佈局中嗎?我的猜測是它的圖像沒有被顯示。 – inazaruk
我先刪除了圖片,然後放了一個textview ...但是,在啓動屏幕加載過程中文本也沒有顯示.... TT –