How can I get an Android MediaController to appear from layout xml?

android

Solution

From this sample project:

ctlr=new MediaController(this);
ctlr.setMediaPlayer(video);
video.setMediaController(ctlr);

Then, it will appear when you tap the screen towards the bottom edge of your `VideoView`.

In terms of keeping it on screen all the time...I don't know if that's possible. You can always create your own controller -- here's a sample project that creates its own pop-up translucent controller. It's really not all that hard, and you get full control over everything, including arranging for it to be on-screen all the time.

Problem

I've created a layout.xml file with the following XML, but I can't get the MediaController to appear at all. ``` <MediaController android:id="@+id/media_controller" android:layout_width="fill_parent" android:layout_height="200px" android:visibility="visible"/> ``` In code, I can obtain a reference to it from code, call show(), etc, but it never appears. I have noticed in the android dev documentation (MediaController.html) that it states, "The way to use this class is to instantiate it programatically.", so maybe I'm a dufus and just need to do something differently such as not do what I'm doing. :) I CAN get it to appear if I do it programmatically, but I need it to always appear on the screen. Am I just being stupid, or is it just not meant to be inflated via XML?

Original source