-1
我想在Android 5.1的全屏模式下播放VideoView
的視頻。此外,我想在一段時間後停止視頻(並改變活動)(比如說5分鐘)。我怎樣才能做到這一點?我的佈局如下:在一段時間後停止Android視頻
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_height="fill_parent"
android:paddingLeft="2px"
android:paddingRight="2px"
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="2px"
android:paddingBottom="2px"
android:layout_width="fill_parent"
android:orientation="vertical">
<VideoView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/VideoView" />
</LinearLayout>
以下代碼:
import android.app.Activity;
import android.os.Bundle;
import android.widget.VideoView;
public class VideoViewDemo extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView videoView = (VideoView)findViewById(R.id.VideoView);
videoView.setVideoPath("/sdcard/test.mp4");
videoView.start();
}
}
的可能的複製[如何在Android的延遲之後調用一個方法] (https://stackoverflow.com/questions/3072173/how-to-call-a-method-after-a-delay-in-android) – 0X0nosugar