安装后按钮不会显示在应用程序中

Button won't show up in app after installed

我尝试构建一个二维码扫描器,当我在 apk 上安装时,按钮没有出现在应该出现的位置。

这是我的按钮代码:

 <Button
    android:id="@+id/scan_btn"
    android:layout_width="127dp"
    android:layout_height="0dp"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_marginBottom="359dp"
    android:layout_marginStart="117dp"
    android:text="@string/scan"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView2"
    android:layout_marginLeft="117dp" />

有人可以帮我解决这个问题吗?

你没有设置按钮的高度,0dp表示不可见

-将其更改为 wrap_content 或更高的 dp。

您将高度保持为 0dp。它在垂直方向上受限吗?