'How to add full screen button to MediaController?
I have a videoView in my app and I want to create a button that clicking him makes the videoView to be full screen. I have a MediaController but it only has resume/pause and rewind/forward. I want to add a full screen button to it.
My xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".video_activity">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<VideoView
android:id="@+id/video1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</FrameLayout>
</RelativeLayout>
Java code:
public class video_activity extends AppCompatActivity {
VideoView videoView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
videoView=findViewById(R.id.video1);
Uri uri=Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.dumbell_press);
videoView.setVideoURI(uri);
MediaController mediaController=new MediaController(this);
videoView.setMediaController(mediaController);
mediaController.setAnchorView(videoView);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
