Android多媒体播放代码:
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.VideoView; public class VideoPlayer extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); final VideoView w =(VideoView)findViewById(R.id.vdoplayer); Button cmdload = (Button)this.findViewById(R.id.cmd_load); cmdload.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub w.setVideoPath("/sdcard/android/kongfu.mp4"); } } ); Button cmdplay = (Button)this.findViewById(R.id.cmd_play); cmdplay.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub w.start(); } } ); Button cmdpause = (Button)this.findViewById(R.id.cmd_pause); cmdpause.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub w.pause(); } } ); }
Android多媒体播放实现代码: xml文件:
< ?xml version="1.0" encoding="utf-8"?> < LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > < Button android:id="@+id/cmd_load" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="load" /> < Button android:id="@+id/cmd_play" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Play" /> < Button android:id="@+id/cmd_pause" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="pause" /> < VideoView android:id="@+id/vdoplayer" android:layout_width="fill_parent" android:layout_height="300px" /> < /LinearLayout>
为什么花140美元买Solana,而Kaanch只要0.64美元?(限时优惠)
随着山寨币势头回升,当前最值得关注的三大预售加密货币——其中一款已筹集超3亿美元
首席软件工程师表示,Ripple技术上并不持有380亿XRP代币
三位市长与比特币从754美元飙升至107,000美元的传奇
PENGU因ETF传闻飙升22%——为何交易者仍对其持悲观态度?
加密货币投资者正关注这5个项目,作为当前最佳投资标的
全民美食街
狗子大挑战
武器编年史
不要在这里停车
采矿冲刺3D
采矿冲刺3D是一款融合动作与策略的冒险佳作,玩家将化身勇敢的
汽车无双
汽车无双是一款以卡通风格为基调的沉浸式汽车驾驶竞技作品,以色
挡火车
挡火车带来充满趣味的休闲益智挑战,操控者在游玩中需动用智慧与
敲1亿小木鱼
敲1亿小木鱼是一款风靡当下的休闲益智趣味之作,玩家通过敲击木
空闲大炮大亨
空闲大炮大亨是一款采用全新物理3D引擎打造的休闲射击佳作,玩