在android开发中,视频的播放一般会使用VideoView来处理,但是现在流行一款开源框架即Vitamio,用它可以打造自己开源的个性化播放器,先给大家放上一个参考连接

http://06.hk/Android/71750.html#

最近项目中开始也用的是VideoView,后来换成了Vitamio,加上了根据手势滑动快进或后退,上下滑动调整音量的效果。。先上两张图

原理其实比较简单。。主要是通过在代码中对布局中view控制显隐来实现,同时同步io.vov.vitamio.widget.VideoView的信息即可


布局文件

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical" >    <io.vov.vitamio.widget.VideoView        android:id="@+id/surface_view"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_centerHorizontal="true"        android:layout_centerVertical="true" />   <RelativeLayout        android:id="@+id/gesture_volume_layout"        android:layout_width="120dip"        android:layout_height="120dip"        android:layout_centerInParent="true"        android:background="@drawable/souhu_player_gesture_bg"        android:gravity="center"        android:visibility="invisible" >        <ImageView            android:id="@+id/gesture_iv_player_volume"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_centerHorizontal="true"            android:src="@drawable/souhu_player_volume" />        <TextView            android:id="@+id/geture_tv_volume_percentage"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_below="@id/gesture_iv_player_volume"            android:layout_centerHorizontal="true"            android:gravity="right"            android:text="80%"            android:textColor="#ffececec" />    </RelativeLayout>    <RelativeLayout        android:id="@+id/gesture_progress_layout"        android:layout_width="120dip"        android:layout_height="80dip"        android:layout_centerInParent="true"        android:background="@drawable/souhu_player_gesture_bg"        android:gravity="center"        android:visibility="invisible" >        <ImageView            android:id="@+id/gesture_iv_progress"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_centerHorizontal="true"            android:src="@drawable/souhu_player_backward" />        <TextView            android:id="@+id/geture_tv_progress_time"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_below="@id/gesture_iv_progress"            android:layout_centerHorizontal="true"            android:gravity="right"            android:text="00:35/24:89"            android:textColor="#ffececec" />    </RelativeLayout></RelativeLayout>
具体的处理我传到资源里面了。。有详细的说明 :别忘了在SD卡根目录下放一个mp4来做测试

资源的地址http://download.csdn.net/detail/yaya_soft/7129941


更多相关文章

  1. 【收藏】Android(安卓)AutoLayout全新的适配方式, 堪称适配终结者
  2. Android(安卓)View - 实现流式布局
  3. Android应用程序UI设计(1)_布局
  4. Android布局文件经验
  5. 【入门篇】Android学习笔记——项目结构及相关基础知识
  6. 鸿蒙开发TV软件环境搭建以及简单教程
  7. Android屏幕自适应4种解决方案
  8. Android:SlidingDrawer
  9. Android(安卓)UI系列-----ScrollView和HorizontalScrollView

随机推荐

  1. android 混淆jar及apk的心得
  2. Android(安卓)Studio 使用Lambda表达式
  3. android source
  4. android 中的 handler
  5. Android Fresco - SimpleDraweeView 圆形
  6. Android字体
  7. Android中ListView的使用
  8. Android工具包AndroidUtils
  9. android.intent.action.MAIN与android.in
  10. 前台android与后台Servlet交互---上传文