I am playing video inside a layout in a ConstraintLayout
and am overriding onConfigurationChanged
rather than restarting the activity in order to prevent the video from stopping and starting on orientation change. I am trying to determine the best way to resize the layout to full screen as the layout is not refreshed during the rotation. The layout uses the following constraints:
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_width="0dp"
android:layout_height="0dp"
After rotation I would like the layout to use the same constraints but with the width and height changing to suit the landscape rather than portrait and vice versa. I currently set the video player layout to the width and height of the screen using DisplayMetrics
but wondering if there is a better solution. RequestLayout
does not seem to do it. Anyone have any better solutions?