分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

Android 利用自带VideoView控件播放视频


Activity

public class Activity01 extends Activity/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {  super.onCreate(savedInstanceState);  setContentView(R.layout.main);  final VideoView videoView = (VideoView) findViewById(R.id.VideoView01);   Button PauseButton = (Button) this.findViewById(R.id.PauseButton);  Button LoadButton = (Button) this.findViewById(R.id.LoadButton);  Button PlayButton = (Button) this.findViewById(R.id.PlayButton);    // load  LoadButton.setOnClickListener(new OnClickListener() {   public void onClick(View arg0)   {//    videoView.setVideoPath("/sdcard/test.mp4");    videoView.setVideoPath("android.resource://com.homer/"+R.raw.china);    videoView.setMediaController(new MediaController(Activity01.this));    videoView.requestFocus();   }  });  // play  PlayButton.setOnClickListener(new OnClickListener() {   public void onClick(View arg0)   {    videoView.start();   }  });  // pause  PauseButton.setOnClickListener(new OnClickListener() {   public void onClick(View arg0)   {    videoView.pause();   }  }); }}

main.xml

<?xml version="1.0" encoding="utf-8"?><AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical" >    <TextView        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/hello" />    <VideoView        android:id="@+id/VideoView01"        android:layout_width="320px"        android:layout_height="240px" />    <Button        android:id="@+id/LoadButton"        android:layout_width="80px"        android:layout_height="wrap_content"        android:layout_x="30px"        android:layout_y="300px"        android:text="装载" />    <Button        android:id="@+id/PlayButton"        android:layout_width="80px"        android:layout_height="wrap_content"        android:layout_x="120px"        android:layout_y="300px"        android:text="播放" />    <Button        android:id="@+id/PauseButton"        android:layout_width="80px"        android:layout_height="wrap_content"        android:layout_x="210px"        android:layout_y="300px"        android:text="暂停" />AbsoluteLayout>

运行效果:



源码下载




           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

更多相关文章

  1. Android开发实践教程
  2. android中置调用指定浏览器
  3. Android(安卓)实例教程
  4. 2020最新版Android一步一步教轻松通过ArcSoft虹软平台实现人脸识
  5. Android微信SDK API 调用教程
  6. Android手机软件汉化教程---第二课 arsc文件汉化
  7. [置顶] Android开机铃声教程,所有Rom,不论CM还是官方,不论是2.3还是
  8. 人工智能交互集成在线语音合成能力的Tips
  9. Java讲师与Android讲师通缉令--悬赏2000元

随机推荐

  1. Android Accessibility(辅助功能) 学习
  2. android秒表计时代码
  3. android多点触摸缩放图片
  4. android slidemenu
  5. 如何自学 Android 编程-----整理stormzha
  6. Android StatusBar
  7. amlogic 编译 android
  8. android颜色管理
  9. android Rect类的使用
  10. Android的Activity启动流程分析