第一步: Activity弹出窗口的布局

<?xml version="1.0" encoding="UTF-8"?>   //布局文件main_top_right_dialog
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="46dp" >
<LinearLayout
android:id="@+id/main_dialog_layout"
android:layout_width="wrap_contenta"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" // 右边
android:layout_alignParentTop="true" // top
android:background="@drawable/title_function_bg" //黑背景图片9
android:orientation="vertical" > <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" > <ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:src="@drawable/mm_title_btn_compose_normal" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="发起聊天"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" > <ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:src="@drawable/mm_title_btn_receiver_normal" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="听筒模式"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" > <ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:src="@drawable/mm_title_btn_keyboard_normal" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="登录网页版"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" > <ImageView
android:id="@+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:src="@drawable/mm_title_btn_qrcode_normal" /> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="扫一扫"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout> </RelativeLayout>

效果图

第二步 .进入到这个弹出的 activity 

public class MainTopRightDialog extends Activity {   //弹出的activity
//private MyDialog dialog;
private LinearLayout layout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_top_right_dialog);
//dialog=new MyDialog(this);
layout=(LinearLayout)findViewById(R.id.main_dialog_layout);
layout.setOnClickListener(new OnClickListener() { @Override
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "提示:点击窗口外部关闭窗口!",
Toast.LENGTH_SHORT).show();
}
});
} @Override
public boolean onTouchEvent(MotionEvent event){ //点击其他的地方关闭
finish();
return true;
} }

 这MainTopRightDialog 在 AndroidManifest.xml的配置

 <activity android:name="MainTopRightDialog" android:theme="@style/MyDialogStyleTop" /> 
styles.xml 的配置 
   <style name="MyDialogStyleTop" parent="android:Theme.Dialog" >
<item name="android:windowAnimationStyle">@style/AnimTop2</item> <!--动画调用其他的样式-->
<item name="android:windowFrame">@null</item> <!--边框-->
<item name="android:windowIsFloating">true</item><!--是否浮现在activity之上-->
<item name="android:windowIsTranslucent">true</item><!--半透明-->
<item name="android:windowNoTitle">true</item> <!--无标题-->
<item name="android:windowBackground">@android:color/transparent</item><!--背景透明-->
<item name="android:backgroundDimEnabled">false</item><!--模糊-->
</style>
styles.xml 的配置(name = AnimTop2)
<style name="AnimTop2" parent="@android:style/Animation">
<item name="android:windowEnterAnimation">@anim/push_top_in2</item>
<item name="android:windowExitAnimation">@anim/push_top_out2</item>
</style>

res 的anim 文件夹下 push_top_in2.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- 上下滑入式 scale缩放-->
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0" <!-- 开始时X方向 缩放比例(1.0代表不缩放)-->
android:toXScale="1.0" <!-- 结尾时X方向 缩放比例(1.0代表不缩放)-->
android:fromYScale="0" <!-- 结尾时Y方向 缩放比例(0代表,最小开始缩放)-->
android:toYScale="1.0" <!-- 结尾时y方向 缩放比例(1.0代表缩放原始比例)-->
android:pivotX="0" <!-- 属性代表缩放的中轴点X坐标-->
android:pivotY="10%" <!-- 代表缩放的中轴点Y坐标-->
android:duration="200" /> <!-- 代表动画持续的时间,单位为毫秒-->

res 的anim 文件夹下push_top_out2.xml

<?xml version="1.0" encoding="utf-8"?>

<scale   xmlns:android="http://schemas.android.com/apk/res/android"   //scale代表缩放
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0" <!-- 开始时X方向 缩放比例(1.0代表不缩放)-->
android:toXScale="1.0" <!-- 结尾时X方向 缩放比例(1.0代表不缩放)-->
android:fromYScale="1.0" <!-- 结尾时y方向 缩放比例(1.0代表缩放原始比例)-->
android:toYScale="0" <!-- 结尾时Y方向 缩放比例(0代表,最小开始缩放)-->
android:pivotX="0" <!-- 属性代表缩放的中轴点X坐标-->
android:pivotY="10%" <!-- 代表缩放的中轴点Y坐标-->
android:duration="200" /> <!-- 代表动画持续的时间,单位为毫秒-->

Activity---弹出右侧窗口的更多相关文章

  1. android在桌面弹出一个窗口

    android在桌面弹出一个窗口 遇到了这种需求,要和iPhone一样的效果. 下面是简单实现功能,优化和美化部分,有时间慢慢搞. 方法应该有不少吧,我用的是弹出一个activity,将这个activ ...

  2. JS弹出模态窗口下拉列表特效

    效果体验:http://hovertree.com/texiao/js/20/ 或者扫描二维码在手机体验: 点击选择城市后,在弹出的层中的输入框,输入英文字母 h,会有HoverTree和Hewenq ...

  3. JS设置弹出小窗口。

    经常上网的朋友可能会到过这样一些网站,一进入首页立刻会弹出一个窗口,或者按一个连接或按钮弹出,通常在这个窗口里会显示一些注意事项.版权信息.警告.欢迎光顾之类的话或者作者想要特别提示的信息.其实制作这 ...

  4. c#自动关闭 MessageBox 弹出的窗口

    我们都知道,MessageBox弹出的窗口是模式窗口,模式窗口会自动阻塞父线程的.所以如果有以下代码: MessageBox.Show("内容',"标题"); 则只有关闭 ...

  5. JS 弹出模态窗口解决方案

    最近在项目中使用弹出模态窗口,功能要求: (1)模态窗口选择项目 (2)支持选择返回事件处理 在IE中有showModalDialog 方法,可以很好的解决该问题,但是在Chrome中和FF中就有问题 ...

  6. 创建一个弹出DIV窗口

    创建一个弹出DIV窗口 摘自:   http://www.cnblogs.com/TivonStone/archive/2012/03/20/2407919.html 创建一个弹出DIV窗口可能是现在 ...

  7. QUI操作超时弹出登录窗口登录的处理方式

    在使用QUI开发的业务系统中,如果长时间没操作,session过期后,再次操作系统超时会自动跳转到登陆页面,如果当前有一些操作没有保存,需要重新登录后再次填写信息,用户体验很不好! 为了避免超时后页面 ...

  8. 解决弹出的窗口window.open会被浏览器阻止的问题(自定义open方法)

    由于在使用window.open时,在很多情况下,弹出的窗口会被浏览器阻止,但若是使用a链接target='_blank',则不会,基于这一特点,自己封装了一个open方法: function ope ...

  9. WPF FileFolderDialog 和弹出子窗口的一些问题

    摘要:本文主要是WPF中 FileFolderDialog的相关问题,补充了关于在父窗口弹出子窗口,以及子窗口的相关属性(Data Binding)和命令绑定(Delegate Command)问题, ...

随机推荐

  1. 第13条:合理利用try/expect/else/finally结构中的每个代码块

    核心知识点: (1)无论try块是否发生异常,都可以使用try/finally复合语句中地finally块来执行清理工作. (2)顺利运行try块后,若想使某些操作能在finally块地清理代码之前执 ...

  2. c/c++ 输入输出技巧

    C: 小数的四舍五入问题 小数用 %.xf 输出的话 是会自动四舍五入的 比如说 double e = 2.718, c = 3.141; printf("%.2lf\n", e) ...

  3. [原创] hadoop学习笔记:重新格式化HDFS文件系统

    所谓的重新格式化HDFS文件系统,实际意味着重新的创建一个HDFS文件系统.也就是说,必须将先前的已经有的文件系统配置删除.如下: 笔者采用的是最小化安装 这个是core-site.xml配置 这个是 ...

  4. CSS知识点 2

    回顾: 浮动:是css中布局最多的一个属性 有浮动,一定要清除浮动浮动不是一个元素单独浮动,要浮动一起浮动 清除浮动四种方式:1.给父盒子添加高度,一般导航栏2.给浮动元素后面加一个空的块标签,  并 ...

  5. centos 中 增强web服务器安全

    一.修改ssh连接的默认端口: 1.1 用root 连接进入系统: 1.2 修改ssh的配置文件 #vi /etc/ssh/sshd_config 在13行找到#Port 22 (默认端口22) 1. ...

  6. Build Antlr4 projects with eclipse java project template.

    from:https://shijinglu.wordpress.com/2015/01/22/build-antlr4-projects-with-eclipse-java-project-temp ...

  7. pugixml 1.9 manual解读(部分)

    Plain character data nodes (node_pcdata) represent plain text in XML. PCDATA nodes have a value, but ...

  8. Codeforces 219D Choosing Capital for Treeland:Tree dp

    题目链接:http://codeforces.com/problemset/problem/219/D 题意: 给你一棵树,n个节点. 树上的边都是有向边,并且不一定是从父亲指向儿子的. 你可以任意翻 ...

  9. PHP消息队列用法实例分析

    这篇文章主要介绍了PHP消息队列用法,结合实例形式分析了PHP消息队列用于Linux下进程间通信的相关技巧,需要的朋友可以参考下   该消息队列用于linux下,进程通信 队列状态信息:具体参考手册

  10. 手把手编写PHP框架 深入了解MVC运行流程

    1 什么是MVC MVC模式(Model-View-Controller)是软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Model).视图(View)和控制器(Controller ...