我已經在它幾個小時了...請任何人都可以指出這個問題嗎?android應用程序顯示空白白色屏幕而不是閃屏
這是我的價值觀/風格:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="android:windowDisablePreview">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Transparent" parent="AppTheme">
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
這是我的清單文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nuku.mc.myfypapp">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.Transparent">
<activity
android:name=".SplashScreen"
android:theme="@style/Theme.Transparent"
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=".LoginActivity"
android:label="@string/app_name"
android:windowSoftInputMode="adjustPan"
/>
<activity
android:name=".SignupActivity"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:label="@string/app_name"
android:windowSoftInputMode="adjustPan" />
</application>
</manifest>
這是應用程序splash_screen.xml文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lin_lay"
android:background="@android:color/holo_orange_dark">
<ImageView
android:layout_width="360dp"
android:layout_height="480dp"
android:id="@+id/imageView2"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:background="@android:color/holo_orange_dark"
android:contentDescription="@string/splash_text"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/splash_text"
android:id="@+id/splashText"
android:layout_marginBottom="150dp"
android:layout_alignBottom="@+id/imageView2"
android:layout_centerHorizontal="true"
android:textStyle="bold|italic"
android:focusable="true"
android:textSize="@dimen/design_fab_image_size"
android:textColor="#ffffff" />
</RelativeLayout>
這是濺。 java
public class SplashScreen extends Activity {
SessionManager manager;
public void onAttachedToWindow() {
super.onAttachedToWindow();
Window window = getWindow();
window.setFormat(PixelFormat.RGBA_8888);
}
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
manager = new SessionManager();
StartAnimations();
}
private void StartAnimations() {
Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
anim.reset();
RelativeLayout l=(RelativeLayout) findViewById(R.id.lin_lay);
l.clearAnimation();
l.startAnimation(anim);
anim = AnimationUtils.loadAnimation(this, R.anim.translate);
anim.reset();
ImageView iv = (ImageView) findViewById(R.id.imageView);
iv.clearAnimation();
iv.startAnimation(anim);
Thread background = new Thread() {
public void run() {
try {
// Thread will sleep for 3 seconds
sleep(3*1000);
// After 5 seconds redirect to another intent
String status=manager.getPreferences(SplashScreen.this,"status");
Log.d("status",status);
if (status.equals("1")){
Intent i=new Intent(SplashScreen.this,MainActivity.class);
startActivity(i);
}else{
Intent i=new Intent(SplashScreen.this,LoginActivity.class);
startActivity(i);
}
//Remove activity
finish();
} catch (Exception e) {
}
}
};
// start thread
background.start();
}
}
我現在跟着五個以上的教程,仍然無法解決問題
感謝您分享文章 –