第一步: 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. 【二】MongoDB入门

    下面是mongodb的一些基本概念: 文档是MongoDB中数据的基本单元,类似关系数据库中的行. 集合,是存储文档的容器,类似关系数据库中的表. MongoDB的单个实例容纳多个数据库,每个数据库都 ...

  2. P4022 [CTSC2012]熟悉的文章

    题目 P4022 [CTSC2012]熟悉的文章 题目大意:多个文本串,多个匹配串,我们求\(L\),\(L\)指(匹配串中\(≥L\)长度的子串出现在文本串才为"熟悉",使得匹配 ...

  3. server.xml笔记

    本文总结自: http://www.importnew.com/26156.html 核心元素: 顶层元素: server service 连接器: connector 容器: engine > ...

  4. 2014年互联网IT待遇

    1. 13k*14~16k*145.美团 13k*15~16k*15,也有更高的.6.去哪儿 11k*16~15k*167.人人技术类(12K-14K)*14 (2014)8.58同城 20w+9.网 ...

  5. Qt中 QTableWidget用法总结

    转自--> http://edsionte.com/techblog/archives/3014 http://hi.baidu.com/fightiger/item/693aaa0f0f87d ...

  6. spring学习(3)

    bean的声明周期 为什么把生命周期当做一个重点? Servlet->servlet生命周期 Servlet生命周期分为三个阶段: 1:初始化阶段,调用init()方法 2:响应客户请求阶段,调 ...

  7. 分享知识-快乐自己:Liunx-大数据(Hadoop)初始化环境搭建

    大数据初始化环境搭建: 一):大数据(hadoop)初始化环境搭建 二):大数据(hadoop)环境搭建 三):运行wordcount案例 四):揭秘HDFS 五):揭秘MapReduce 六):揭秘 ...

  8. strnpy函数

    函数原型: char * strncpy ( char * destination, const char * source, size_t num ); 功能:从字符串source中复制 num个字 ...

  9. 一种解决 MacBook 里的 App Store 无法登录的问题

    刚刚买回来的 2018 款带有 touchbar 的 MacBook Pro 15 inc 在用 App Store 安装 app 时一直无法登录成功(网络链接都是好的),导致软件都无法更新,折腾了挺 ...

  10. 【转】CSS制作图形速查表-存档

      http://www.w3cplus.com/css/css-simple-shapes-cheat-sheet http://www.cnblogs.com/powertoolsteam/p/c ...