开发者

Customize look and feel of Android VideoView Interface

How can I customize the look and feel of VideoView interface in Android? I'd especially like to replace the progress bar, yellow background and media(pause/play) buttons with my own.

XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<VideoView
  android:id="@+id/surface_view"
  android:layout_width="320px"
  android:layout_height="240px"/>
</LinearLayout>

Code

public class VideoViewExample extends Activity {
   private VideoView mVideoView;

   @Override
   public void onCreate(Bundle icicle) {
     super.onCreate(icicle);
     setContentView(R.layout.main);
     mVideoView = (VideoView) findViewById(R.id.surface_view);
     mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() +"/"+R.raw.sm));
     mVideoView.setMediaController(new MediaController(this));
     mVideoView.requestFocus();
     mVideoView.start();
 开发者_如何学JAVA  }
}


I'd especially like to replace the progress bar, yellow background and media(pause/play) buttons with my own.

That is not "the VideoView user interface". That is the MediaController. It may be possible to style the MediaController, though I just elected to replace it the last time I encountered this issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜