遇到一个问题,先记录一下

PopWindow自定义动画

import android.app.Activity;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.PopupWindow; public class ActivityMain extends Activity { private int screenWidth;
private int screenHeigh; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
System.out.println("xirtam " + Build.VERSION.SDK);
System.out.println("xirtam " + Build.VERSION.SDK_INT);
{// 获取屏幕宽高
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
screenWidth = dm.widthPixels;
screenHeigh = dm.heightPixels;
} LayoutInflater inflater = LayoutInflater.from(this);
// 引入窗口配置文件
View view = inflater.inflate(R.layout.main2, null);
// 创建PopupWindow对象
final PopupWindow pop = new PopupWindow(view,
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, false);
Button btn = (Button) findViewById(R.id.btn);
// 需要设置一下此参数,点击外边可消失
pop.setBackgroundDrawable(new BitmapDrawable());
// 设置点击窗口外边窗口消失
pop.setOutsideTouchable(true);
// 设置此参数获得焦点,否则无法点击
pop.setFocusable(true);
btn.setOnClickListener(new OnClickListener() { @Override
public void onClick(View v) {
if (pop.isShowing()) {
// 隐藏窗口,如果设置了点击窗口外小时即不需要此方式隐藏
pop.dismiss();
} else {
// 显示窗口
pop.setAnimationStyle(R.style.PopupAnimation);
pop.showAtLocation(v, Gravity.NO_GRAVITY, 0, screenHeigh);
// pop.showAsDropDown(v);
pop.update();
} }
});
} }

layout/main1.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="点我是小狗" /> </LinearLayout>

layout/main2.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <Button
android:id="@+id/a"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="小狗你好" /> </LinearLayout>

values/styles.xml

<style name="PopupAnimation" mce_bogus="1" parent="android:Animation">
<item name="android:windowEnterAnimation">@anim/enter</item>
<item name="android:windowExitAnimation">@anim/exit</item>
</style>

anim/enter.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="3500"
android:fromYDelta="100%"
android:toYDelta="1%" > </translate>

anim/exit.xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="3500"
android:fromYDelta="1%"
android:toYDelta="100%" > </translate>

问题是在nexus5上 showAtLocation 没反应,其他机型未发现此问题。

Popwindow自定义动画(nexus5不支持暂未解决)的更多相关文章

  1. openerp学习笔记 计算字段、关联字段(7.0中非计算字段、关联字段只读时无法修改保存的问题暂未解决)

    计算字段.关联字段,对象修改时自动变更保存(当 store=True 时),当 store=False 时,默认不支持过滤和分组7.0中非计算字段.关联字段只读时无法修改保存的问题暂未解决 示例代码: ...

  2. scanf的一个问题(暂未解决)

    如下代码,没有按照预想的那样运行: int a; char b; printf("input a integer\n"); scanf("%d", &a ...

  3. Python中暂未解决的问题

    编写一个复杂的计算器,可以在通过GUI输出出来.参考代码http://www.cnblogs.com/BeginMan/p/3216093.html shelve模块中open()函数调用文件文件的路 ...

  4. 使用MinIO中暂未解决的问题

    时间显示问题 web页面上创建桶的时间跟使用SDK获取的时间不一样,相差8个小时,但是mc命令行客户端获取的时间跟web上的一样

  5. 「HTML+CSS」--自定义加载动画【014】【疑问未解决】

    前言 Hello!小伙伴! 首先非常感谢您阅读海轰的文章,倘若文中有错误的地方,欢迎您指出- 哈哈 自我介绍一下 昵称:海轰 标签:程序猿一只|C++选手|学生 简介:因C语言结识编程,随后转入计算机 ...

  6. Jfrog Artifactory jenkins 流水线使用docker的方式培训[暂未成功]

    1. 创建jenkins的流水线 2. 创建artifactory的镜像仓库 3. 创建generic的仓库上传需要的 war包还有tar包. 4. 修改pipeline的 脚本 主要修改的地方. 修 ...

  7. 记录未解决的问题:docker中无法启动mysqld

    首先在docker中安装mysql server的包: sudo yum install mysql sudo yum install mariadb-server mariadb /usr/libe ...

  8. 深入学习jQuery自定义动画

    × 目录 [1]属性对象 [2]可选参数 [3]选项参数 前面的话 很多情况下,前面介绍的jQuery动画的简单效果无法满足用户的各种需求,那么就需要对动画有更多的限制,需要采取一些高级的自定义动画来 ...

  9. CSS3初学篇章_6(自定义动画)

    自定义动画 由于有一部分低版本的浏览器并不支持的问题,所以这个样式要多做兼容,各大浏览器兼容前缀如下: 前缀 浏览器  -webkit  chrome和safari  -moz  firefox  - ...

随机推荐

  1. css 层叠样式表

    css选择器 派生选择器 根据其元素在其上下文关系来定义样式 <style type="text/css">body{ font-size:12px; color:re ...

  2. CSS3 box-shadow快速教程

    box-shadow 属性向框添加一个或多个阴影.这个CSS3的属性很常用,盒阴影.按钮状态等各种地方都有用到,但是你了解并记住各个参数的作用及用法吗? 展示 源码:http://codepen.io ...

  3. NOIP201103瑞士轮

    试题描述 [背景]在双人对决的竞技性比赛,如乒乓球.羽毛球.国际象棋中,最常见的赛制是淘汰赛和循环赛.前者的特点是比赛场数少,每场都紧张刺激,但偶然性较高.后者的特点是较为公平,偶然性较低,但比赛过程 ...

  4. java开源网站

    1.http://www.java1234.com 2.http://www.2cto.com/Soft/

  5. 【C语言】12-指向一维数组元素的指针

    一.用指针指向一维数组的元素 1 // 定义一个int类型的数组 2 int a[2]; 3 4 // 定义一个int类型的指针 5 int *p; 6 7 // 让指针指向数组的第0个元素 8 p ...

  6. Scala _ [underscore] magic

    I started learning Scala a few days before. Initially i was annoyed by the use of too many symbols i ...

  7. SAE saestorage.class.php文件的封装代码

    Source for file saestorage.class.php Documentation is available at saestorage.class.php <?php /** ...

  8. 分布式缓存(Cache)

    1. 单层分布式cache. 如memcache. 2. 多层分布式cache. 服务端和调用者本地都存放cache, 使用udp组播解决cache同步更新问题,但不可靠. 3. 改进的多层分布式ca ...

  9. flowvisor test(1)

    参考: Flowvisor 入门 杨帅老师:mininet+FlowVisor+ODL环境搭建及实验1 安装: 参考: 1.Flowvisor安装 2.Mininet安装 3.官网,Floodligh ...

  10. SVN 树冲突的解决方法(Ubuntu 环境)

    今天在 服务器上(Ubuntu) svn up 更新的时候,出现了 SVN 树冲突 root@futongdai:~# cd /home/wwwroot/newcrm.ofim.com/ root@f ...