Activity---弹出右侧窗口
第一步: 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---弹出右侧窗口的更多相关文章
- android在桌面弹出一个窗口
android在桌面弹出一个窗口 遇到了这种需求,要和iPhone一样的效果. 下面是简单实现功能,优化和美化部分,有时间慢慢搞. 方法应该有不少吧,我用的是弹出一个activity,将这个activ ...
- JS弹出模态窗口下拉列表特效
效果体验:http://hovertree.com/texiao/js/20/ 或者扫描二维码在手机体验: 点击选择城市后,在弹出的层中的输入框,输入英文字母 h,会有HoverTree和Hewenq ...
- JS设置弹出小窗口。
经常上网的朋友可能会到过这样一些网站,一进入首页立刻会弹出一个窗口,或者按一个连接或按钮弹出,通常在这个窗口里会显示一些注意事项.版权信息.警告.欢迎光顾之类的话或者作者想要特别提示的信息.其实制作这 ...
- c#自动关闭 MessageBox 弹出的窗口
我们都知道,MessageBox弹出的窗口是模式窗口,模式窗口会自动阻塞父线程的.所以如果有以下代码: MessageBox.Show("内容',"标题"); 则只有关闭 ...
- JS 弹出模态窗口解决方案
最近在项目中使用弹出模态窗口,功能要求: (1)模态窗口选择项目 (2)支持选择返回事件处理 在IE中有showModalDialog 方法,可以很好的解决该问题,但是在Chrome中和FF中就有问题 ...
- 创建一个弹出DIV窗口
创建一个弹出DIV窗口 摘自: http://www.cnblogs.com/TivonStone/archive/2012/03/20/2407919.html 创建一个弹出DIV窗口可能是现在 ...
- QUI操作超时弹出登录窗口登录的处理方式
在使用QUI开发的业务系统中,如果长时间没操作,session过期后,再次操作系统超时会自动跳转到登陆页面,如果当前有一些操作没有保存,需要重新登录后再次填写信息,用户体验很不好! 为了避免超时后页面 ...
- 解决弹出的窗口window.open会被浏览器阻止的问题(自定义open方法)
由于在使用window.open时,在很多情况下,弹出的窗口会被浏览器阻止,但若是使用a链接target='_blank',则不会,基于这一特点,自己封装了一个open方法: function ope ...
- WPF FileFolderDialog 和弹出子窗口的一些问题
摘要:本文主要是WPF中 FileFolderDialog的相关问题,补充了关于在父窗口弹出子窗口,以及子窗口的相关属性(Data Binding)和命令绑定(Delegate Command)问题, ...
随机推荐
- (转载)C #开源框架
Json.NET http://json.codeplex.com/ Json.Net 是一个读写Json效率比较高的.Net框架.Json.Net 使得在.Net环境下使用Json更加简单.通过Li ...
- Oracle数据库体系结构(7) 表空间管理1
表空间是Oracle数据库最大的逻辑存储结构,有一系列段构成.Oracle数据库对象存储结构的管理主要是通过表空间的管理实现的. 1.表空间的分类 表空间根据存储类型不同分为系统表空间和非系统表空间 ...
- 第六篇 javascript面向对象
一.闭包 闭包是指可以包含自由(未绑定到特定对象)变量的代码块. 「闭包」,是指拥有多个变量和绑定了这些变量的环境的表达式(通常是一个函数),因而这些变量也是该表达式的一部分. 闭包是个函数,而它「记 ...
- 什么是tmpfs
什么是tmpfs tmpfs是Linux/Unix系统上的一种基于内存的文件系统.tmpfs可以使用您的内存或swap分区来存储文件. 实现原理:基于VM子系统 tmpfs是基于Linux的虚拟内存管 ...
- java 多线程踩过的坑
多线程踩坑记录:1.多线程切记不可以同时操作同一个原子数据.解释:存在一个条数据库A数据,不可以在2个或2个以上的线程中同时操作A数据.会引发重复操作.2.多线程操作方法不要加synchronized ...
- jquery中bind,live,delegate,on的区别
这几种方法都是绑定事件用到的,但是他们之间有些差别 bind(type,[data],fn) 为每个匹配元素的特定事件绑定事件处理函数 例如: <ul> <a href=" ...
- 分享知识-快乐自己:mybatis 主键回调
以下两种方式实现 主键回掉方式. <!--添加用户信息:主键回调--> <insert id="insertUser" useGeneratedKeys=&quo ...
- Oracle--存储过程和自定义函数
一.相关概念 1.存储过程和存储函数 ~指存储在数据库中供所有用户程序调用的子程序 ~存储过程和存储函数的相同点:完成特定功能的程序 ~存储过程和存储函数区别:是否用return语句返回值 2.创建和 ...
- 7_DoubleBuffer 游戏编程中的双缓存模式
### double buffer 双缓存 简单说: 当一个缓存被读取的时候,往另一个缓存里写入, 如此交替 #### the pattern 有两个缓存实例,一个是 current buffer, ...
- codeforces 29D Ant on the Tree (dfs,tree,最近公共祖先)
D. Ant on the Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard ...