Android中Popuwindown的使用(我的项目中扣出的代码)
来源:互联网 发布:mastercam9.1编程视频 编辑:程序博客网 时间:2024/05/19 01:28
<pre name="code" class="html">if (popupwindow != null&&popupwindow.isShowing()) {popupwindow.dismiss();return;} else {initmPopupWindowView();// popupwindow.showAsDropDown(view, 0, 5);popupwindow.showAsDropDown(view, 0, PARAM.Dp2Px(context, 5));}
<span style="font-family: Arial, Helvetica, sans-serif;">public void initmPopupWindowView() {</span>
// // 获取自定义布局文件pop.xml的视图View customView = getLayoutInflater().inflate(R.layout.mystock_detail_popup_window_2,null, false);// 创建PopupWindow实例,200,150分别是宽度和高度//popupwindow = new PopupWindow(customView, 300, 360);//180,200popupwindow = new PopupWindow(customView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);// 设置动画效果 [R.style.AnimationFade 是自己事先定义好的]popupwindow.setAnimationStyle(R.style.AnimationFade);//popupwindow.setOutsideTouchable(true);// 自定义view添加触摸事件customView.setOnTouchListener(new OnTouchListener() {@Overridepublic boolean onTouch(View v, MotionEvent event) {if (popupwindow != null && popupwindow.isShowing()) {popupwindow.dismiss();popupwindow = null;}return false;}});img_delet = (ImageView) customView.findViewById(R.id.img_delet);img_share = (ImageView) customView.findViewById(R.id.img_share);img_delet.setOnClickListener(this);img_share.setOnClickListener(this);}
<style name="AnimationFade"> <!-- PopupWindow左右弹出的效果 --> <item name="android:windowEnterAnimation">@anim/inuptodown</item> <item name="android:windowExitAnimation">@anim/outdowntoup</item> </style>
inputodown.xml<?xml version="1.0" encoding="UTF-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="500" android:fromYDelta="-100%" android:toYDelta="0" /></set>
outdowntoup.xml<?xml version="1.0" encoding="UTF-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="500" android:fromYDelta="0" android:toYDelta="-100%" /></set>
0 0
- Android中Popuwindown的使用(我的项目中扣出的代码)
- 我的Android进阶之旅------>Android Studio使用statistics插件统计项目代码总行数
- 在项目中xmlhttp,我的使用
- 我项目中使用的Facade模式
- 项目中使用ecTable的代码
- 我在敲代码的过程中使用的工具
- 我的android项目架构
- 我的Android项目规范
- 我的android代码风格
- android 项目中线程池的使用
- Android 项目中使用 的 优化建议
- Android 项目中ButterKnife的基本使用
- Android项目中Git的使用
- android我的菜谱项目中添加数据库
- access数据库的使用,直接贴项目中使用代码
- 【我的Android进阶之旅】如何在浏览器上使用Octotree插件树形地展示Github项目代码?
- 我在使用的android开源项目
- 为什么我的项目中要使用Redis
- Socket
- 定型的产品该怎么提升用户留存率
- 重写JavaScript的eval和document.write方法
- 【Mybatis】Mybatis整合spring
- cf400A
- Android中Popuwindown的使用(我的项目中扣出的代码)
- opendns security blog
- Netty学习笔记一 项目demo
- 第11周 项目四-类族的设计
- Java网络编程之IP地址和InetAddress类
- cf276B
- 指针的应用
- VS2015预览版体验
- Java网络编程之统一资源定位符URL