【发布时间】:2022-12-18 02:03:31
【问题描述】:
在此布局中,app:layout_constraintBottom_toBottomOf="@+id/preview" 允许我将文本放在相机预览的底部 like this
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/preview_container"
android:layout_height="match_parent"
android:layout_width="match_parent">
<androidx.camera.view.PreviewView
android:id="@+id/preview"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="W,4:3"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<TextView
android:id="@+id/test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/preview"
app:layout_constraintStart_toStartOf="@id/preview"
android:text="TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST" />
</androidx.constraintlayout.widget.ConstraintLayout>
但是,如何将该文本移动到相机预览like this 的边缘?
【问题讨论】:
-
@LeonardoVelozo 不幸的是,没有。我想重新定位我的现存的上的 TextView相机预览.
标签: android xml kotlin layout android-camera