I am developing an application for Android mobiles
. i want to play an video. It's working fine. Now i have one issue. i want to set the corner for VideoView
. Is it possible to set the corner for VideoView
?
I using following xml code:
<RelativeLayout
android:id="@+id/video_relative"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<VideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
And in my java code:
myVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.my_video));
myVideoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mediaPlayer) {
// close the progress bar and play the video
// progressDialog.dismiss();
//if we have a position on savedInstanceState, the video playback should start from here
myVideoView.seekTo(position);
if (position == 0) {
myVideoView.start();
}
else {
//if we come from a resumed activity, video playback will be paused
myVideoView.pause();
}
}
});
Please someone help me to solve this issue.
I set corner for videoview successfully. My solution is simple. I just set the background for video view. The background image is 9-patch image only color at the corner center is just transparent. I don't know it is clean solution or not but it solved my issue.