半黑&应用程序启动前的白屏

时间:2017-09-02 02:41:40

标签: android

我的Android应用程序显示半黑&启动画面前的白色屏幕。 half black & white screen

我不知道我在下面做的是我的启动布局xml代码

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_splash"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    android:background="@color/colorPrimary"
    tools:context="com.jarvis.easysplay.SplashActivity">

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="200dp"
        android:layout_height="220dp"
        android:contentDescription="@string/app_name"
        android:src="@drawable/logo2"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintRight_toRightOf="parent" />

    <TextView
        android:id="@+id/tagline"
        android:layout_width="0dp"
        android:layout_height="382dp"
        android:gravity="bottom|center_horizontal"
        android:textColor="@color/white"
        android:textAlignment="center"
        android:textSize="@dimen/_26sdp"
        android:text="@string/app_name"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.574"
        app:layout_constraintHorizontal_bias="1.0" />


</android.support.constraint.ConstraintLayout>

这是我的启动活动类

公共类SplashActivity扩展了AppCompatActivity {

    private final int SPLASH_DISPLAY_LENGTH = 5000;
//    private FirebaseAnalytics mFirebaseAnalytics;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_splash);
   }
}

2 个答案:

答案 0 :(得分:0)

将此行添加到主题

<item name="android:windowDisablePreview">true</item>

<item name="android:windowAnimationStyle">@null</item>

答案 1 :(得分:0)

尝试删除约束布局,而不是使用线性或相对布局