2013-04-30 1 views
0

내 앱을 시작할 때 짧은 시간 동안 검정색을 변경하고 싶지만 아직 내용이 표시되지 않습니다.안드로이드에서 다른 레이아웃으로 레이아웃을 옮길 때 오류가 발생했습니다.

이 검은 색은 splash.xml에서 activity_main.xml까지 전송할 때 나타납니다. 몇 분이 걸리고 내 응용 프로그램이 열립니다.

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(); 
} 

} 

내 splash.xml입니다 : - - :

내 StartPoint.java 클래스입니다

<?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> 

및 activity_main.xml 코드는 다음과 같습니다 -

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/screen" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@drawable/bg"> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:orientation="vertical" 
     > 

     <LinearLayout 
      android:layout_weight="6" 
      android:orientation="vertical" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_width="fill_parent" 
      android:layout_height="0dip" > 

     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/buttons" 
      android:layout_width="match_parent" 
      android:layout_height="0dip" 
      android:layout_alignParentLeft="true" 
      android:layout_weight="0.62" 
      android:background="@drawable/iconbgrepate" 
      android:gravity="center" 
      android:orientation="horizontal" 
      android:tileMode="repeat" 
      android:weightSum="5" 
      android:alpha=".75"> 

     <SeekBar 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/volumebar" 
      android:max="100" 
      android:paddingBottom="10dip"/> 

     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/buttons" 
      android:layout_width="match_parent" 
      android:layout_height="0dip" 
      android:layout_alignParentLeft="true" 
      android:layout_weight="0.62" 
      android:background="@drawable/iconbgrepate" 
      android:gravity="center" 
      android:orientation="horizontal" 
      android:tileMode="repeat" 
      android:weightSum="5" > 

      <Button 
       android:id="@+id/btnRefresh" 
       android:layout_width="32dp" 
       android:layout_height="match_parent" 
       android:layout_margin="5dp" 
       android:layout_weight="0.10" 
       android:background="@drawable/refreshbutton" /> 

      <View android:layout_weight="1" 
       android:layout_width="0dip" 
       android:layout_height="0dip" /> 

      <Button 
       android:id="@+id/btnPause" 
       android:layout_width="32dp" 
       android:layout_height="match_parent" 
       android:layout_margin="5dp" 
       android:layout_weight="0.05" 
       android:background="@drawable/pausebutton" /> 

      <View android:layout_weight="1" 
       android:layout_width="0dip" 
       android:layout_height="0dip" /> 

      <Button 
       android:id="@+id/btnPlay" 
       android:layout_width="32dp" 
       android:layout_height="match_parent" 
       android:layout_margin="5dp" 
       android:layout_weight="0.05" 
       android:background="@drawable/playbutton" /> 

      <View android:layout_weight="1" 
       android:layout_width="0dip" 
       android:layout_height="0dip" /> 

      <Button 
       android:id="@+id/btnExit" 
       android:layout_width="32dp" 
       android:layout_height="match_parent" 
       android:layout_margin="5dp" 
       android:layout_weight="0.12" 
       android:background="@drawable/exitbutton" /> 

     </LinearLayout> 
    </LinearLayout> 
</RelativeLayout> 

및 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> 

내 문제는 어디에 ??

답변

0

스플래시 화면 레이아웃은 선형 레이아웃 구성 요소 중 하나에 가중치가 있지만 다른 구성 요소에는 가중치가 없다는 점에서 이상합니다. 나는 가중치 합을 더하거나 둘 다에 가중치를 주겠다. 동일한 금액을 소비하려면 1과 1을 사용하십시오.

또한 가중치를 처리 할 때 동일한 방향 (높이 또는 너비)의 wrap_content를 원합니다. 그래서 디자인은 아마도 약간의 개조가 필요합니다. 그것이 내가 처음으로 알아 차리는 것입니다.

+0

어디에서 어떻게 할 수 있습니까? 나는 당신을 이해하지 못합니다, 저는 새로운 안드로이드 개발입니다. –

관련 문제