2013-03-27 1 views
2

많은 파기를 시도했지만이 문제에 대한 문제를 해결할 수 없습니다. 문제는 내 앱의 스플래시 화면 때문입니다. 스플래시 화면은 Google Galaxy Nexus를 제외한 모든 기기/태블릿에서 문제없이 실행됩니다. 스플래시 화면을 표시하는 대신 빈 검은 색 화면이 나타나고 내 앱의 기본 화면이 열립니다.Google Galaxy Nexus Phone에서 SplashScreen과 관련된 문제가 발생했습니다.

아래의 logcat을 확인했는데 그곳에는 범인과 비슷한 경고가 하나 있습니다.

03-26 22:51:34.878: D/dalvikvm(26506): GC_FOR_ALLOC freed 30K, 1% free 8662K/8720K, paused 19ms, total 20ms 
03-26 22:51:34.894: I/dalvikvm-heap(26506): Grow heap (frag case) to 12.390MB for 4096016-byte allocation 
03-26 22:51:34.917: D/dalvikvm(26506): GC_FOR_ALLOC freed <1K, 1% free 12661K/12724K, paused 20ms, total 20ms 
03-26 22:51:34.925: D/dalvikvm(26506): GC_CONCURRENT freed <1K, 1% free 12661K/12724K, paused 2ms+1ms, total 15ms 
03-26 22:51:34.996: D/dalvikvm(26506): GC_FOR_ALLOC freed <1K, 1% free 12661K/12724K, paused 9ms, total 10ms 
03-26 22:51:35.058: I/dalvikvm-heap(26506): Grow heap (frag case) to 28.013MB for 16384016-byte allocation 
03-26 22:51:35.089: D/dalvikvm(26506): GC_FOR_ALLOC freed 0K, 1% free 28661K/28728K, paused 31ms, total 31ms 
03-26 22:51:35.128: D/dalvikvm(26506): GC_CONCURRENT freed <1K, 1% free 28661K/28728K, paused 12ms+2ms, total 36ms 
03-26 22:51:35.347: I/System.out(26506): true 
03-26 22:51:35.503: D/libEGL(26506): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so 
03-26 22:51:35.535: D/libEGL(26506): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so 
03-26 22:51:35.542: D/libEGL(26506): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so 
03-26 22:51:35.917: D/OpenGLRenderer(26506): Enabling debug mode 0 
03-26 22:51:36.027: W/OpenGLRenderer(26506): Bitmap too large to be uploaded into a texture (1600x2560, max=2048x2048) 
03-26 22:51:36.871: V/CheatsDB.db(26506): db exists 
03-26 22:51:37.207: D/dalvikvm(26506): GC_FOR_ALLOC freed 6206K, 18% free 28757K/35028K, paused 14ms, total 14ms 

"업로드하기에 너무 큰 비트 맵 ...."이라는 줄이 있습니다. 나는 드로어 블을 점검했고 큰 사이즈의 그런 이미지가 없다. 스플래시 스크린에서 사용되는 배경 이미지는 800 x 1280입니다. 이것은 현재 모든 장치에서 사용하는 유일한 PNG 이미지이며 스플래시 화면은 다른 모든 장치에서 정상적으로 작동합니다. 또한 logcat은 이미지의 크기가 1600 x 2560처럼 보이며 Nexus 10의 해상도라고 생각합니다. 그 크기의 특정 이미지를 추가하지 않았습니다.

또한 아래에있는 내 SplashScreen.java 파일의 코드를 게시하고있다 :

public class SplashScreen extends Activity { 

private final int SPLASH_DISPLAY_TIME = 1000; 
private Handler splashHandler = new Handler(); 
private Runnable splashRunnable; 
private final String firstLaunchCheck = "firstLaunchCheck"; 
SharedPreferences mPrefs; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 

    super.onCreate(savedInstanceState); 
    this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
    setContentView(R.layout.splash_screen); 

    mPrefs = PreferenceManager.getDefaultSharedPreferences(this); 

    final Boolean isFirstLaunch = mPrefs.getBoolean(firstLaunchCheck, false); 

    System.out.println(isFirstLaunch); 

    splashRunnable = new Runnable() { 
     @Override 
     public void run() { 

      if (!isFirstLaunch) { 

       SharedPreferences.Editor editor = mPrefs.edit(); 
       editor.putBoolean(firstLaunchCheck, true); 
       editor.commit(); 

       Intent mainIntent = new Intent(SplashScreen.this, 
         LookItUpTutorial.class); 

       mainIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); 

       startActivity(mainIntent); 
       SplashScreen.this.finish(); 


      } 
      else { 

       Intent mainIntent = new Intent(SplashScreen.this, 
         LandingPage.class); 
       startActivity(mainIntent); 

       SplashScreen.this.finish(); 
      } 
     } 
    }; 

    splashHandler.postDelayed(splashRunnable, SPLASH_DISPLAY_TIME); 
} 

// Remove any call back activities when back/home button is pressed on 
// SplashScreen 
@Override 
public void onPause() { 
    super.onPause(); 

    splashHandler.removeCallbacks(splashRunnable); 
    SplashScreen.this.finish(); 
} 
} 
또한

내 레이아웃 추가 :

<?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" 
    android:background="@drawable/appbackground"> 

</LinearLayout> 

사람이 내가의 원인을 추적에 대해 갈 수있는 방법에 대한 포인터를 나에게 줄 수를 이 문제 ? 나는 그것이 이미지 크기 경고와 관련이 있다고 믿지만 그 다음에는 내 소스 코드에 큰 이미지가 없다. 어떤 도움이라도 대단히 감사하겠습니다.

이 큰 게시물을 들러서이 책을 읽은 것에 감사드립니다.

+0

스플래시 화면 이미지를 400x640으로 줄이고 증상이 변경되는지 확인하는 것이 좋습니다. –

답변

2

게시 한 레이아웃을 기반으로 왜 안드로이드가 이미지 크기를 조정하는지 잘 모릅니다. 그러나 약간의 노력으로 우리가 막을 수 있습니다.

레이아웃 파일에서 android:drawable을 제거하고 LinearLayout에 ID를 제공하십시오. 그런 다음 drawable을 코드로로드하십시오.

View mylinearlayout = findViewById(R.id.mylinearlayout); 
Options options = new Options(); 
options.inScaled = false; // explicitly disable all scaling 
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.appbackground, options); 
mylinearlayout.setBackground(new BitmapDrawable(bmp)); 
+0

이것은 정확히 내가 한 일입니다. 스플래시 화면 배경 이미지는/res/drawable 디렉토리에 있습니다. 그러나 문제는 여전히 존재합니다. –

+0

레이아웃을 볼 수 있습니까? –

+0

게시글에 레이아웃 부분을 추가했습니다. 시간 내 줘서 고마워. –

1

전 몇 달 전에 동일한 문제가 있습니다. 수 시간 동안 조사한 후. 사진의 크기가 큰 것 같습니다 (사용 된 그림의 해상도는 1400x1600입니다). 그런 다음 다시 확장하려고 시도했습니다. 600x800 (품질은 여전히 ​​허용됩니다).

p/s JB 4.1을 실행하는 Google Galaxy Nexus에서이 문제가 발생했습니다.

관련 문제