TextureView在模拟器中拉伸。如果我将TextureView的宽度和高度设置为正方形(500dp x 500dp)。在模拟器中,预览被拉伸并显示在矩形中。
此代码取自Google Sample中的CameraX。
这是我的fragment_camera.xml代码:
<TextureView
android:id="@+id/view_finder"
android:layout_width="500dp"
android:layout_height="500dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />