ConstraintLayout中的图像会在编辑器中正确显示,但在运行应用程序时会打包在一起

问题描述

enter image description here

这是预览中的外观。

这是这6张图片的xml代码

<androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/mutationsConst"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/mutationsbg"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/mutationTextConst">

        <ImageView
            android:id="@+id/mutationWhite"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/ic_mutation_white"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/mutationGreen"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageView
            android:id="@+id/mutationGreen"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/ic_mutationgreen"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/mutationRed"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/mutationWhite"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageView
            android:id="@+id/mutationRed"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/ic_mutationred"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/mutatioBlue"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/mutationGreen"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageView
            android:id="@+id/mutatioBlue"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/ic_mutationblue"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/mutationBlack"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/mutationRed"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageView
            android:id="@+id/mutationBlack"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/ic_mutationblack"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/mutationGold"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/mutatioBlue"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageView
            android:id="@+id/mutationGold"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:src="@drawable/ic_mutationgold"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/mutationBlack"
            app:layout_constraintTop_toTopOf="parent" />


    </androidx.constraintlayout.widget.ConstraintLayout>

此Costraint在此父约束之内

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/ipsDrawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="left"
    android:layout_marginEnd="0dp"
    android:background="#C0E2FA"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent">

,这是它在模拟器中的显示方式

enter image description here

我不知道是什么原因造成的。 布局用作从左侧出来的抽屉。 这6张图片是svg图片,其余是位图

这是整个xml文件 https://pastebin.com/MwYw2Vrk

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)