<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<VideoView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/videoview"
></VideoView>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<VideoView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/videoview"
></VideoView>
</LinearLayout>
먼저 간단하게 XML에 VideoView를 작성합니다
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_view);
VideoView video = (VideoView)findViewById(R.id.videoview);
super.onCreate(savedInstanceState);
setContentView(R.layout.video_view);
VideoView video = (VideoView)findViewById(R.id.videoview);
그 후 액티비티를 1개 생성한 후 VideoView에 추가하여줍니다.
video.setVideoPath("/mnt/sdcard/download/2.wmv");
video.setOnCompletionListener(this);
final MediaController mc = new MediaController(Video_View.this);
video.setMediaController(mc);
video.postDelayed(new Runnable() {
public void run() {
mc.show(0);
}
},100);
video.start();
video.setVideoPath("/mnt/sdcard/download/2.wmv");
- 비디오뷰에 플레이할 영상을 선택한다.
final MediaController mc = new MediaController(Video_View.this);
video.setMediaController(mc);
-현재뷰에 MediaController를 등록합니다
video.postDelayed(new Runnable() {
public void run() {
mc.show(0);
}
video.start();
-비디오를 실행시킵니다
'Mobile_Programing > Android' 카테고리의 다른 글
Unsigned Byte 사용법 (2) | 2011.04.01 |
---|---|
안드로이드에서 3G를 사용할때 Ip주소를 확인하자 (0) | 2011.03.26 |
Zxing을 세로모드를 인식률 높게 사용해보자. (0) | 2011.03.23 |
안드로이드에서 TTS 서비스를 해보자 (1) | 2011.03.20 |
JDK 설정 (0) | 2011.02.12 |