Android游戏开发学习笔记(三):视频的播放
	一、在命令行下输入mksdcard 512M c:\sdcard.img命令,创建sdcard镜像文件。
	二、单击Eclipse的菜单命令“Window/Preferences”,打开Preferences窗口,在左侧选中“Android/Launch”,在右侧的“Default emulator options”中填入“-sdcard c:\sdcard.img”。
	三、启动模拟器,切换视图到DDMS,找到“File Explorer”窗口,选中“mnt/sdcard”,执行右上角的“Push a file onto the device”,向sdcard中添加视频文件“qtfy01.3gp”。
	四、编写项目的布局文件main.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"
	    >
	    <SurfaceView
	        android:id="@+id/surfaceView"   
	        android:layout_width="fill_parent"  
	        android:layout_height="380px"  
	        />
	    <LinearLayout  
	        android:layout_width="fill_parent"
	        android:layout_height="wrap_content"
	        >
	        <Button
	            android:id="@+id/play_btn"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:text="播放"
	            />
	        <Button
	            android:id="@+id/pause_btn"
	            android:layout_width="wrap_content"
	            android:layout_height="wrap_content"
	            android:text="暂停"
	            />
	    </LinearLayout>
	</LinearLayout>
	五、编写MainActivity.java代码。
	package game.test; 
	 
	import android.app.Activity; 
	
相关新闻>>
- 发表评论
- 
				
- 最新评论 进入详细评论页>>





