Note that there are some explanatory texts on larger screens.

plurals
  1. POExtending MediaController for android
    text
    copied!<p>I am using a <code>VideoView</code> and the <code>MediaController</code> for an app I am working on. I simply wanted to have the <code>MediaController</code> appear on top of my <code>VideoView</code> but apparently you can't do that very easily. I attempted to use the <code>setAnchorView</code> method to my <code>VideoView</code> id, but that didn't work. No matter what I do, the <code>MediaController</code> is always at the bottom of my screen. </p> <p>With that said, I did some research and it looks as if I go about extending <code>MediaController</code>, I can change position and other properties. I have created a new class:</p> <pre><code>package com.dop.mobilevforum; import android.content.Context; import android.widget.MediaController; public class VFPlayer extends MediaController { public VFPlayer(Context context) { super(context); } } </code></pre> <p>and in my parent class:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.vforum); controller = new VFPlayer(this); vidPlayer = (VideoView) findViewById(R.id.vidPlayer); vidPlayer.setMediaController(controller); } </code></pre> <p>It the above is working, my default <code>MediaController</code> still pops up and has all the same functionality. The question is now, how do I go about actually repositioning the controller from inside my <code>VFPlayer</code> class?</p> <p><img src="https://i.stack.imgur.com/3IljC.jpg" alt="enter image description here"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload