第一步 : 退出时候的布局文件exit_dialog_from_settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal" >
<LinearLayout
       android:id="@+id/exit_layout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" //高度包裹内容
android:layout_gravity="bottom" //父布局 的底部
android:background="@drawable/exit_dialog_bg" // 黑背景图片 9
android:gravity="center_horizontal" // 里面 横向 居中
android:orientation="vertical" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center"
android:text="退出后不会删除任何历史数据,下次\n登录依然可以使用本帐号"
android:textColor="#fff"
android:textSize="16sp" /> <Button
android:id="@+id/exitBtn0"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:background="@drawable/btn_style_alert_dialog_special"
android:gravity="center"
android:onClick="exitbutton0"
android:text="退出登录"
android:textColor="#fff"
android:textSize="18sp" /> <Button
android:id="@+id/exitBtn1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp" //间隔左边
android:layout_marginRight="10dp" //间隔右边
android:layout_marginTop="15dp"
android:background="@drawable/btn_style_alert_dialog_cancel"
android:gravity="center"
android:onClick="exitbutton1"
android:text="取消"
android:textColor="#fff"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

里面的drawable 下  btn_style_alert_dialog_special.xml

<?xml version="1.0" encoding="UTF-8"?>  //btn_style_alert_dialog_special
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/btn_style_alert_dialog_special_pressed" />
<item android:drawable="@drawable/btn_style_alert_dialog_special_normal" />
</selector>

btn_style_alert_dialog_cancel.xml 选择器

<?xml version="1.0" encoding="UTF-8"?>//btn_style_alert_dialog_cancel
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/btn_style_alert_dialog_button_pressed" />
<item android:drawable="@drawable/btn_style_alert_dialog_cancel_normal" />
</selector>

第二步 : 弹出窗口的ExitFromSettings 

public class ExitFromSettings extends Activity {
//private MyDialog dialog;
private LinearLayout layout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.exit_dialog_from_settings);
//dialog=new MyDialog(this);
layout=(LinearLayout)findViewById(R.id.exit_layout2);
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;
} public void exitbutton1(View v) { // 关闭当前
this.finish();
}
public void exitbutton0(View v) {
this.finish();
MainWeixin.instance.finish();//关闭Main 这个Activity
} }

  AndroidManifest.xml 中配置ExitFromSettings

  <activity android:name="ExitFromSettings" android:theme="@style/MyDialogStyleBottom"
style.xml的配置 
  <style name="MyDialogStyleBottom" parent="android:Theme.Dialog" >
<item name="android:windowAnimationStyle">@style/AnimBottom</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">true</item><!--模糊-->
</style>
style.xml的配置 name= "AnimBottom"
<style name="AnimBottom" parent="@android:style/Animation">
<item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
<item name="android:windowExitAnimation">@anim/push_bottom_out</item>
</style>
anim文件夹下: push_bottom_in     (translate位移动画)
<?xml version="1.0" encoding="utf-8"?>
<!-- 上下滑入式 -->
<set xmlns:android="http://schemas.android.com/apk/res/android" > <translate
android:duration="200"
android:fromYDelta="50%p" //从屏幕下面的 50% 进入
android:toYDelta="0" /> // 到 0 的位置 </set>
anim文件夹下: push_bottom_out
<?xml version="1.0" encoding="utf-8"?>
<!-- 上下滑入式 位移动画translate-->
<set xmlns:android="http://schemas.android.com/apk/res/android" > <translate
android:duration="200"
android:fromYDelta="0" // 从屏幕0 的位置
android:toYDelta="50%p" /> // 到屏幕向下50% </set>
												

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)问题, ...

  10. 用MPLAB IDE编程时,软件总是弹出一个窗口提示: “the extended cpu mode configuration bit is enabled,but the program that was loaded was not built using extended cpu instructions. therefore,your code may not work properly

    用MPLAB IDE编程时,软件总是弹出一个窗口提示:"the extended cpu mode configuration bit is enabled,but the program ...

随机推荐

  1. Linux expect介绍和用法

    expect时用与提供自动交互的工具.比如如果想要用ssh登陆服务器,每次都输入密码你觉得麻烦,那你就可以使用expect来做自动交互,这样的话就不用每次都输入密码了. 先看例子: #!/usr/bi ...

  2. HTML 获取屏幕,浏览器,页面的高度

    1,物理尺寸和分辨率 容器的尺寸是指当前分辨率下的高度.宽度,而不是物理高度.宽度. 如:一个22寸的显示器,屏幕分辨率为1366 * 768,那么获取到的屏幕高度为1366px,宽度为768px. ...

  3. html5 css3 进度条特效

    https://www.html5tricks.com/tag/css3%E8%BF%9B%E5%BA%A6%E6%9D%A1/page/3

  4. 【leetcode刷题笔记】Scramble String

    Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrin ...

  5. MySQL部署时Table 'mysql.plugin' doesn't exist的解决

    今天部署了免安装版的MySQL,出现了Table 'mysql.plugin' doesn't exist的问题,苦恼了好久,终于在网上找到了解决方案,现整理一下给大家分享: 系统环境:Win10 6 ...

  6. Android_微信_设置

    减少 内存的使用 (http://news.ifeng.com/a/20170716/51440541_0.shtml) 1.关闭“附近的人” 打开微信,依次点击[我]—[设置]—[通用]—[功能], ...

  7. linux 设备文件

    一.设备文件 在dev目录下 外部设备通过创建好的设备文件连接到服务器上,例如可以通过设备号给连接上去的硬件发消息. 二.设备文件分类 块设备 按块为单位,随机访问的设备 常见的有 硬盘 字符设备 按 ...

  8. Java Applet:练习TextField类和TextArea类的文本事件

    出自: Java语言与面向程序程序设计(第二版) 第七章第五节P223 1. [代码]java代码 /** *这个程序主要来练习文本事件,当在文本框(TextField)中输入文字时,会在文本域(Te ...

  9. webserver的编写中出现的问题

    在webserver编写过程中,出现过问题.就是标签<input>编写过程中少了name属性,导致程序无法读到<form>提交的数据.

  10. js 禁止用户使用Ctrl+鼠标滚轮缩放网页

    为什么会有人会使用ctrl+鼠标滚轮缩放网页?坚决禁止! <html> <head> <title>测试</title> <script lang ...