Android Studio-XML预览的颜色错误

我和一个同学 现在在Github上分享了我们的项目。 他的XML预览器看起来不错,并且可以正常工作。 但是我的XML预览器有一些错误 我想念我的预览器为何与最终结果如此不同?

我的视图(离开Android Studio的内置,再离开仿真器):

enter image description here

他的视图(工作正常-左侧为Android Studio,右侧为模拟器):

enter image description here

我的布局文件

    <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorBackground"
    tools:context=".UserInterface.MainActivity">


    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/button_shopingEntryAdd"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="?attr/actionModeSplitBackground"
        android:clickable="true"
        android:src="@drawable/trashcan"
        android:visibility="invisible"
        app:backgroundTint="@android:color/holo_green_light"
        app:layout_constraintBottom_toTopOf="@+id/guideline57"
        app:layout_constraintEnd_toStartOf="@+id/guideline51"
        app:layout_constraintStart_toStartOf="@+id/guideline55"
        app:layout_constraintTop_toTopOf="@+id/guideline56"
        tools:visibility="visible" />

    <ListView
        android:id="@+id/listView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:autoSizeTextType="uniform"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/guideline5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/view_Topbar">

    </ListView>


    <View
        android:id="@+id/view_Topbar"
        android:layout_width="0dp"
        android:layout_height="0dp"

        android:background="@drawable/round_corner"
        app:layout_constraintBottom_toTopOf="@+id/guideline14"
        app:layout_constraintEnd_toStartOf="@+id/guideline51"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="@+id/guideline3"
        app:layout_constraintTop_toTopOf="@+id/guideline4"
        app:layout_constraintVertical_bias="1.0" />


    <Button
        android:id="@+id/btnNavFrag1"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@drawable/fragment_active_button"
        android:fontFamily="casual"
        android:includeFontPadding="false"
        android:text="@string/fragment1_name"
        android:textSize="13sp"
        app:layout_constraintBottom_toTopOf="@+id/guideline11"
        app:layout_constraintEnd_toStartOf="@+id/guideline8"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/guideline10" />

    <Button
        android:id="@+id/btnNavFrag2"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@drawable/fragment_buttons"
        android:fontFamily="casual"
        android:text="@string/fragment2_name"
        android:textSize="13sp"
        app:layout_constraintBottom_toBottomOf="@+id/btnNavFrag1"
        app:layout_constraintEnd_toStartOf="@+id/guideline9"
        app:layout_constraintStart_toStartOf="@+id/guideline8"
        app:layout_constraintTop_toTopOf="@+id/guideline10" />


    <Button
        android:id="@+id/btnNavFrag3"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@drawable/fragment_buttons"
        android:fontFamily="casual"
        android:text="@string/fragment3_name"
        android:textSize="13sp"
        app:layout_constraintBottom_toTopOf="@+id/guideline11"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@+id/guideline9"
        app:layout_constraintTop_toTopOf="@+id/guideline10" />

    <Button
        android:id="@+id/button_navSecond"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@drawable/menu"
        app:layout_constraintBottom_toTopOf="@+id/guideline52"
        app:layout_constraintEnd_toStartOf="@+id/guideline19"
        app:layout_constraintStart_toStartOf="@+id/guideline3"
        app:layout_constraintTop_toTopOf="@+id/guideline53"
        tools:visibility="visible" />

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@color/colorPrimary"
        android:minHeight="?attr/actionBarSize"
        android:theme="?attr/actionBarTheme"
        app:collapseIcon="@android:drawable/ic_menu_call"
        app:layout_constraintBottom_toTopOf="@+id/guideline10"
        app:layout_constraintEnd_toStartOf="@+id/guideline5"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0" />

    <TextView
        android:id="@+id/textView_titleP2"
        android:layout_width="202dp"
        android:layout_height="58dp"
        android:autoText="false"
        android:fontFamily="casual"
        android:gravity="center"
        android:text="FoodGent"
        android:textColor="#FAFAFA"
        android:textSize="30sp"
        android:textStyle="bold"
        app:autoSizeTextType="uniform"
        app:layout_constraintBottom_toTopOf="@+id/guideline10"
        app:layout_constraintStart_toStartOf="@+id/guideline19"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/textView_topBarName"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:fontFamily="casual"
        android:gravity="center"
        android:text="@string/fragment1_name"
        android:textSize="15sp"
        android:textStyle="bold"
        app:layout_constraintBottom_toTopOf="@+id/guideline14"
        app:layout_constraintEnd_toStartOf="@+id/guideline51"
        app:layout_constraintStart_toStartOf="@+id/guideline3"
        app:layout_constraintTop_toTopOf="@+id/guideline4" />

    <Button
        android:id="@+id/button_add"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:autoText="false"
        android:background="@drawable/empty_drawable"
        android:gravity="center"
        android:text="+"
        android:textColor="@color/colorBackground"
        android:textSize="30sp"
        app:layout_constraintBottom_toTopOf="@+id/guideline10"
        app:layout_constraintEnd_toStartOf="@+id/guideline5"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="@+id/guideline32"
        app:layout_constraintTop_toTopOf="parent" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.05352798" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline51"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.95" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline5"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="1.0" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline32"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.88" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline55"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.81" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.33819953" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline9"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.66423357" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline12"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.58" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline19"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.09" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.15" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.08" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline52"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.05" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline53"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.034" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline11"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.14" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline14"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.18" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline56"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.89" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline57"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.98" />


</androidx.constraintlayout.widget.ConstraintLayout>
评论