第一步: 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. HR_ROS 节点信息

    https://stackoverflow.com/questions/24638063/install-node-serialport-module-on-arm-linux https://blo ...

  2. rest-client restclient get post写法

    get url = "https://api.weixin.qq.com/sns/jscode2session" data = { appid: "××××", ...

  3. 高性能js之数据访问性能

    js中si中基本数据访问: 直接量, 变量, 数组项, 对象成员 性能问题: 首先要理解作用域链的基本概念,例如,当一个函数被创建时,就会产生一个激活对象(AO对象),AO对象中存储了该函数中所有的属 ...

  4. centos web+mysql服务器的安全

    今天闲来无事,拿来X-Scan-v3.3 来扫描自己的服务器,开放端口有22,80,443,3306:3306端口被扫出来,呵呵,那可不得了: 一,屏蔽扫描器扫出3306端口,因为web和数据库是在同 ...

  5. HDU Rightmost Digit

                                                     Rightmost Digit Time Limit:1000MS     Memory Limit: ...

  6. css 中 div垂直居中的方法

    在说到这个问题的时候,也许有人会问CSS中不是有vertical-align属性来设置垂直居中的吗?即使是某些浏览器不支持我只需做少许的CSS Hack技术就可以啊!所以在这里我还要啰嗦两句,CSS中 ...

  7. jQuery与javascript库

    [jquery-javascript库] 为了简化javascript的开发,诞生了javascript程序库,他封装了很多预定的对象和实用函数.下面是几种流行的javascript程序库:proto ...

  8. long long 与 __int64

    1.long long VC中不能用,codeblocks中 可以 #include<iostream> #include<stdio.h> using namespace s ...

  9. AngularJS学习笔记(三) 单页面webApp和路由(ng-route)

    就我现在的认识,路由($route)这个东西(也许可以加上$location)可以说是ng最重要的东西了.因为angular目前最重要的作用就是做单页面webApp,而路由这个东西是能做到页面跳转的关 ...

  10. Redis命令参考之复制(Replication)

    Redis 支持简单且易用的主从复制(master-slave replication)功能, 该功能可以让从服务器(slave server)成为主服务器(master server)的精确复制品. ...