I use a tutorial video inside VideoView
. But video is not fill VideoView
while playing and has black part in VideoView
because that has Rectangular view. I can not solution for it. I tried to cover VideoView
by CardView
and make cardRadius. But It’s not remove all black part as properly. How can do this? Can not make VideoView
background
radius?
VideoFragment.kt
private fun initVideo() {
simpleVideoView = binding.videoViewTutorial
simpleVideoView?.setVideoURI(
Uri.parse("android.resource://" + requireActivity().packageName + "/" + R.raw.tutorial)
)
simpleVideoView?.requestFocus()
simpleVideoView?.start()
}
fragment_video.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/tabContainerUser"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottomNavigationView"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_gravity="bottom"
android:layout_margin="30dp"
android:background="@drawable/background_white_gray_stroke_60dp_radius"
app:itemIconSize="27dp"
app:labelVisibilityMode="unlabeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu_user" />
<ImageView
android:id="@+id/ivAskAdvise"
android:layout_width="50dp"
android:layout_height="50dp"
android:translationZ="999dp"
android:src="@drawable/ic_black_plus_yellow_bg"
app:layout_constraintBottom_toBottomOf="@+id/bottomNavigationView"
app:layout_constraintEnd_toEndOf="@+id/bottomNavigationView"
app:layout_constraintStart_toStartOf="@+id/bottomNavigationView"
app:layout_constraintTop_toTopOf="@+id/bottomNavigationView"
app:layout_constraintVertical_bias="0.63"
tools:ignore="ContentDescription" />
<View
android:id="@+id/viewBlackBg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black_0_70"
android:visibility="gone"
android:translationZ="999dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<!-- <androidx.cardview.widget.CardView
android:id="@+id/cardViewVideo"
android:layout_width="0dp"
android:layout_height="0dp"
app:cardCornerRadius="70dp"
app:cardBackgroundColor="@color/transparent"
android:visibility="gone"
android:translationZ="999dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.80"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.80"
tools:visibility="visible">-->
<VideoView
android:id="@+id/videoViewTutorial"
android:layout_width="0dp"
android:layout_height="0dp"
android:translationZ="999dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_percent="0.80"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.80"
tools:visibility="visible"/>
<!--</androidx.cardview.widget.CardView>-->
<TextView
android:id="@+id/tvSkipTutorial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:fontFamily="@font/mulish_regular"
android:text="@string/skip"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="gone"
android:translationZ="999dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/videoViewTutorial"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>