Android仿UC底部弹出式菜单导航栏源码
程序员文章站
2022-03-01 13:52:32
...
本Demo是一个模仿UC浏览器安卓版底部Menu PopupWindow的效果的、一个Menu PopupWindow实现的小例子源码、实现方法比较简单、可根据自己的需求更改、喜欢的哥们可以下载研究一下、还是仿得比较像的、效果图如下
功能已经封装好了、下面贴上调用方法、在onCreate方法里面
菜单栏分类标题
titles = new ArrayList<String>(); titles = addItems(new String[]{"常用", "设置", "工具"});
选项图标
item_images = new ArrayList<List<Integer>>(); item_images.add(addItems(new Integer[] { R.drawable.ic_action_call, R.drawable.ic_action_camera, R.drawable.ic_action_copy, R.drawable.ic_action_crop, R.drawable.ic_action_cut, R.drawable.ic_action_discard, R.drawable.ic_action_download, R.drawable.ic_action_edit })); item_images.add(addItems(new Integer[] { R.drawable.ic_action_email, R.drawable.ic_action_full_screen, R.drawable.ic_action_help, R.drawable.ic_action_important, R.drawable.ic_action_map, R.drawable.ic_action_mic, R.drawable.ic_action_picture, R.drawable.ic_action_place })); item_images.add(addItems(new Integer[] { R.drawable.ic_action_refresh, R.drawable.ic_action_save, R.drawable.ic_action_search, R.drawable.ic_action_share, R.drawable.ic_action_switch_camera, R.drawable.ic_action_video, R.drawable.ic_action_web_site, R.drawable.ic_action_screen_rotation }));
选项名称
item_names = new ArrayList<List<String>>(); item_names.add(addItems(new String[] { "电话", "相机", "复制", "裁剪", "剪切", "删除", "下载", "编辑" })); item_names.add(addItems(new String[] { "邮件", "全屏", "帮助", "收藏", "地图", "语音", "图片", "定位" })); item_names.add(addItems(new String[] { "刷新", "保存", "搜索", "分享", "切换", "录像", "浏览器", "旋转屏幕" }));
设置菜单栏推拉动画效果
myPopupMenu = new MyPopupMenu(this, titles, item_names, item_images); //设置菜单栏推拉动画效果 // res/anim中的xml文件与styles.xml中的style配合使用 myPopupMenu.setAnimationStyle(R.style.PopupAnimation);
源代码下载链接: http://dwtedx.com/download.html?bdkey=s/1hqeomfa 密码: phzr