日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Android多媒體播放功能的代碼解析

我們曾經(jīng)在其他文章中通過對錄音以及錄像的實現(xiàn)方法具體講解過有關Android多媒體錄制的相關操作技巧。在這里我們將會為大家詳細介紹一下Android多媒體播放的應用方式,以幫助大家對這方面的應用知識有一個深刻的印象。

Android多媒體播放代碼:

 
 
 
  1. import android.app.Activity;   
  2. import android.os.Bundle;   
  3. import android.view.View;   
  4. import android.view.View.OnClickListener;   
  5. import android.widget.Button;   
  6. import android.widget.VideoView;   
  7. public class VideoPlayer extends Activity   
  8. {   
  9. /**   
  10. Called when the activity is first created.   
  11. */ @Override   
  12. public void onCreate(Bundle icicle)   
  13. {   
  14. super.onCreate(icicle);   
  15. setContentView(R.layout.main);   
  16. final VideoView w =(VideoView)findViewById(R.id.vdoplayer);   
  17. Button cmdload = (Button)this.findViewById(R.id.cmd_load);   
  18. cmdload.setOnClickListener(new OnClickListener()  
  19. {   
  20. public void onClick(View arg0)   
  21. {   
  22. // TODO Auto-generated method stub   
  23. w.setVideoPath("/sdcard/android/kongfu.mp4");   
  24. }   
  25. }  
  26. );   
  27. Button cmdplay = (Button)this.findViewById(R.id.cmd_play);   
  28. cmdplay.setOnClickListener(new OnClickListener()  
  29. {   
  30. public void onClick(View arg0)   
  31. {   
  32. // TODO Auto-generated method stub   
  33. w.start();   
  34. }   
  35. }   
  36. );   
  37. Button cmdpause = (Button)this.findViewById(R.id.cmd_pause);   
  38. cmdpause.setOnClickListener(new OnClickListener()  
  39. {   
  40. public void onClick(View arg0)   
  41. {   
  42. // TODO Auto-generated method stub   
  43. w.pause();   
  44. }   
  45. }  
  46. );   
  47. }   
  48. }  
  49. main.xml: 

Android多媒體播放實現(xiàn)代碼:

 
 
 
  1. < ?xml version="1.0" encoding="utf-8"?> 
  2. < LinearLayout xmlns:android=
    "http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 
  3. < Button android:id="@+id/cmd_load" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" android:text="load" /> 
  4. < Button android:id="@+id/cmd_play" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" android:text="Play" /> 
  5. < Button android:id="@+id/cmd_pause" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" android:text="pause" /> 
  6. < VideoView android:id="@+id/vdoplayer" 
    android:layout_width="fill_parent" 
    android:layout_height="300px" /> 
  7. < /LinearLayout>  

Android多媒體播放的具體代碼編寫方式就為大家介紹到這里。

【編輯推薦】

  1. Android target類型選擇技巧
  2. Android錄音失真具體解決方案
  3. Android屏幕大小相關技巧應用指南
  4. Android多媒體錄制功能的實現(xiàn)方式介紹
  5. Android圖片大小調(diào)整動態(tài)實現(xiàn)方法

網(wǎng)站題目:Android多媒體播放功能的代碼解析
轉載來于:http://m.5511xx.com/article/ccdchid.html