Я пытаюсь обрезать VideoView в адаптере с соотношением 4/5, который использует math_parent для ширины и wrap_content для высоты. Проблема в том, что видео всегда искажается, а высота соответствует родительскому. Это мой ряд XML-макет:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"
style="@style/RCPostRow"
>
...
<android.support.constraint.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:layout_marginTop="8dp"
>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/postFrameLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="4:5"
>
<VideoView
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
/>
</FrameLayout>
</android.support.constraint.ConstraintLayout>
...
</LinearLayout>
Если я использую ImageView вместо VideoView с scaleType = centerCrop, это работает:
<ImageView
android:id="@+id/postImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@color/grey"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:minHeight="250dp"
/>
Кроме того, если я использую match_parent в качестве высоты (вместо wrap_content), видео автоматически настраивается таким образом, чтобы оно подходило для своего родителя (портретный режим), и появляются 2 белых поля (интервал слева и справа)