2013-04-30 66 views
0

我想在短时间内删除白色,但应用程序正在启动但内容未显示。更改应用程序启动期间的白色背景

我的主要活动是: -

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

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="17" /> 

    <uses-permission android:name="android.permission.INTERNET" /> 

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

</manifest> 

怎能取代白色背景的进步吧?

更新: - mainfest.xml:

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

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="17" /> 

    <uses-permission android:name="android.permission.INTERNET" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name="com.example.kam.StartPoint" 
      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="com.example.kam.MainActivity"/> 
    </application> 

</manifest> 

splash.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" > 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:src="@drawable/loading" /> 

<ProgressBar 
    android:id="@+id/progressBar1" 
    style="?android:attr/progressBarStyleHorizontal" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1.67" /> 

</LinearLayout> 

startpoint.class

public class StartPoint extends Activity{ 

ProgressBar progressBar; 
private int progressBarStatus = 0; 

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

    progressBar = (ProgressBar)findViewById(R.id.progressBar1); 


    Thread timer = new Thread(){ 
     public void run(){ 
      try{ 
       sleep(5000); 
       while(progressBarStatus < 5000){ 
        StartPoint.this.runOnUiThread(new Runnable(){ 
         public void run() 
         { 
          progressBar.setProgress(progressBarStatus); 
          progressBarStatus += 1000; 
         } 
        }); 

       } 
      }catch(InterruptedException e){ 
       e.printStackTrace(); 
      }finally{ 
       Intent openMainList = new Intent(StartPoint.this, com.example.kam.MainActivity.class); 
       startActivity(openMainList); 
      } 
     } 
    }; 
    timer.start(); 
} 

protected void onPause(){ 
    super.onPause(); 
    finish(); 
} 

} 

我会尝试,但是当打开装载图像和打开主布局显示错误

+1

使用闪屏 – 2013-04-30 05:57:53

+0

http://stackoverflow.com/的可能的复制问题/ 5486789 /我怎么做 - 飞溅屏幕在Android – Triode 2013-04-30 05:59:09

+0

@nirav可以回答这个问题[http://stackoverflow.com/questions/16292956/how-to-get-the-videosurls在列表查看] – 2013-04-30 06:08:50

回答

0

有很多tutorialsvideos用于创建启动屏幕,它应该给你想要的结果。

基本步骤是;

  1. 在所需的绘图文件夹中创建一个闪屏图像。
  2. 与图像创建一个主题,它
  3. 使用的主题创建活动,并让该活动启动目前的主要活动
+0

但它没有线程我怎么能用线程做到这一点 – 2013-04-30 06:28:05

+0

你会做任何事情之前,你做任何事情。你做这个你的第一个活动,然后它调用你目前的第一个活动,这将有你的线程。也许我不理解你。 – HalR 2013-04-30 06:29:41

+0

我更新我的帖子,我做你告诉我,但我有问题 – 2013-04-30 07:13:40