我的图像一次又一次地出现在屏幕的左上角,但没有任何解决办法

My image is again and again going to the top left corner of the screen and nothing is fixing it

这是我图片的代码 经过大量研究后,我在图像中输入了它

<Image
    app:constraintToLeft_ToLeftOf="parent"
    app:constraintToRight_ToRightOf="parent"
    app:constraintToBottom_ToBottomOf="parent"
    app:constraintToTop_ToTopOf="parent"
/>

此外,我的图像显示未定义任何标记,这非常令人沮丧,无论何时我在设计视图或文本视图中向屏幕添加对象,结果始终相同。没有什么能帮助我解决这个问题。 我也尝试过给其他人不同的解决方案,但即使我将它拖到视图的中心,它也总是在相同的位置

Android xml 没有 <Image> 标签,请使用 <ImageView> 而不是 <Image>

ConstraintLayout

中没有constraintToLeft_ToLeftOfconstraintToRight_ToRightOfconstraintToBottom_ToBottomOfconstraintToTop_ToTopOf等属性

查看此文档了解更多详情 - ConstraintLayout

试试这个代码:

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintTop_toTopOf="parent"/>