第一步 : 退出时候的布局文件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. ubuntu vim退出时出错

    E505: "vimrc" is read-only (add ! to override) wq退出时加!强制保存退出 "vimrc" E212: Can't ...

  2. iOS中成员变量和属性区别

    历史由来: 接触iOS的人都知道,@property声明的属性默认会生成一个_类型的成员变量,同时也会生成setter/getter方法. 但这只是在iOS5之后,苹果推出的一个新机制.看老代码时,经 ...

  3. Get Docker CE for Ubuntu

    Docker 分为开源免费的 CE(Community Edition)版本和收费的 EE(Enterprise Edition)版本. 配置 Docker 的 apt 源 1. 安装包,允许 apt ...

  4. java深入探究04

    1.Http协议 tcp/ip关注的是客户端服务器之间数据是否传输成功 http协议:是在tcp/ip协议之间封装的一层协议关注的是传输格式是否规范 注意:系统自带的telent工具(远程访问工具)可 ...

  5. jQuery学习(3)

    可以在select中设置size属性的属性值,从而让下拉列表中的选项都显示出来. <!DOCTYPE html> <html> <head> <title&g ...

  6. adb命令(一)

    针对移动端 Android 的测试, adb 命令是很重要的一个点,必须将常用的 adb 命令熟记于心, 将会为 Android 测试带来很大的方便,其中很多命令将会用于自动化测试的脚本当中. And ...

  7. JavaUtil_01_MD5加密

    一.百度翻译MD5工具类 昨天做java微信开发,引用百度翻译API给公众号添加翻译功能时,需要使用MD5生成签名.注意,使用MD5生成签名后一定要转成小写,不然百度翻译后台不会认你这个签名的,会报无 ...

  8. java-StringBuffer常用方法

    对字符串进行修改的时候,需要使用可变长字符串StringBuffer 和 StringBuilder 类. append(String s):将指定的字符串追加到此字符序列. Reverse():将此 ...

  9. 短连接时出现connection reset问题的原因

    网上摘取的感觉有用的文章,保存下来,让大家学习交流! 在使用HttpClient调用后台resetful服务时,“Connection reset”是一个比较常见的问题,有同学跟我私信说被这个问题困扰 ...

  10. 在开发环境中,自己搭建一个ssl环境(小例子)

    做项目的时候自己总结的一些小例子 public class Test { public static void setSSLProperty() { Security.addProvider(new  ...