2011-08-28 89 views
0

如何在Android中自定义VideoView界面的外观?我特别想用我自己的替换进度条,黄色背景和媒体(暂停/播放)按钮。自定义Android VideoView界面的外观和感觉

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> 

代码

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(); 
    } 
} 

回答

0

我特别想更换进度条,黄色的背景和媒体(暂停/播放)按钮,用我自己的。

这不是“VideoView用户界面”。那是MediaController。虽然我只是选择将其替换为the last time I encountered this issue,但您可以对MediaController进行设计。