Android音乐、视频类APP常用控件:DraggablePanel(1)
来源:互联网 发布:天池大数据 经验 编辑:程序博客网 时间:2024/06/05 14:54
Android音乐、视频类APP常用控件:DraggablePanel(1)
Android的音乐视频类APP开发中,常涉及到用户拖曳视频、音乐播放器产生一定交互响应的设计需求,最典型的以YouTube APP为例。
YouTube在开发中,有用到一个第三方开源的可拖曳面板:DraggablePanel。DraggablePanel在github上的项目主页:https://github.com/pedrovgs/DraggablePanel
DraggablePanel的设计效果如动图所示,动图查看链接:https://github.com/pedrovgs/DraggablePanel/tree/develop/art
写一个DraggableView的小例子。
测试的主activity MainActivity.java:
package zhangphil.demo;import android.app.Activity;import android.os.Bundle;import android.widget.ArrayAdapter;import android.widget.ListView;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);String[] data1 = new String[50];for (int i = 0; i < data1.length; i++)data1[i] = "item:" + i;ArrayAdapter adapter1 = new ArrayAdapter(this, android.R.layout.simple_list_item_1, android.R.id.text1, data1);ListView mainListView = (ListView) findViewById(R.id.mainListView);mainListView.setAdapter(adapter1);ListView secondListView = (ListView) findViewById(R.id.secondListView);String[] data2 = { "Z", "H", "A", "N", "G", "P", "H", "I", "L" };ArrayAdapter arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, android.R.id.text1,data2);secondListView.setAdapter(arrayAdapter);}}
布局文件activity_main.xml:
<?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" > <ListView android:id="@+id/mainListView" android:layout_width="match_parent" android:layout_height="match_parent" /> <!-- Draggable View --> <com.github.pedrovgs.DraggableView xmlns:draggable_view="http://schemas.android.com/apk/res-auto" android:id="@+id/draggable_view" android:layout_width="match_parent" android:layout_height="match_parent" draggable_view:bottom_view_id="@+id/secondListView" draggable_view:top_view_id="@+id/image" draggable_view:top_view_margin_bottom="20dip" draggable_view:top_view_margin_right="20dip" draggable_view:top_view_x_scale_factor="2.0" draggable_view:top_view_y_scale_factor="2.0" > <ListView android:id="@+id/secondListView" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/image" android:background="#EF5350" /> <ImageView android:id="@+id/image" android:layout_width="match_parent" android:layout_height="200dip" android:layout_alignParentTop="true" android:background="#42A5F5" android:src="@drawable/ic_launcher" /> </com.github.pedrovgs.DraggableView></RelativeLayout>
代码运行结果:
初始化状态:
向下拖曳时候渐变:
拖曳到最底部的情形:
又拖曳机器人向上:
mainListView在一定程度上可以理解为“背景全部数据”。
DraggableView将是随用户拖曳产生交互响应的面板,在DraggableView里面,再套两层Android View,本例是一个简单的ImageView和一个ListView,ImageView在上,ListView在下,这两者套在DraggableView里面,随用户的拖曳动作产生相应的拖曳滑动。
附录相关文章:
1,《Android自底部平滑向上滑出面板的AndroidSlidingUpPanel》链接地址:http://blog.csdn.net/zhangphil/article/details/51444509
- Android音乐、视频类APP常用控件:DraggablePanel(1)
- Android音乐、视频类APP常用控件:DraggablePanel(2)
- Android第三方开源SeekBarCompat:音乐类播放器等APP进度条常用
- android 音乐播放控件
- Android-Material Design风格MVP模式的新闻App(视频图片音乐)
- Android 停止其他App音乐
- android(42)(音乐播放器,视频播放器)
- Android 音乐柱状频谱控件
- Android学习之常用控件(1)
- Android常用控件学习(1)
- Android中常用控件(1)-TextView
- Android读取音乐视频图片文件
- Android 读取手机音乐,视频,图片
- Android学习之视频音乐列表ListView
- 网页上常用的视频播放器/音乐播放器代码(转载)
- android 常用控件 (GridView)
- Android(4)常用控件
- Android常用控件(二)
- HBase架构核心模块
- 软件架构的风险消除策略
- 操作系统文件系统设计实验报告
- xmlhttp 收发二进制数据 (Sending and Receiving Binary Data)
- iPad横竖屏代码适配
- Android音乐、视频类APP常用控件:DraggablePanel(1)
- plsql连接本地数据库和远程数据库
- 使用stringstream对象简化类型转换
- 如何在Eclipse中加载Android源码
- FZU 2232 炉石传说(二分图最大匹配)
- System.out.println,system.out.print,system.out.printf的区别
- Spring之乐观锁简单理解和实例
- SDUT 3258 Square Number(2015年山东省第六届ACM大学生程序设计竞赛)
- IP、子网掩码