第一步 : 退出时候的布局文件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. LeetCode:验证回文串【125】

    LeetCode:验证回文串[125] 题目描述 给定一个字符串,验证它是否是回文串,只考虑字母和数字字符,可以忽略字母的大小写. 说明:本题中,我们将空字符串定义为有效的回文串. 示例 1: 输入: ...

  2. Ruby 循环

    Ruby while 语句: 语法: while conditional [do] codeend 执行代码当条件为true时.while循环的条件是代码中的保留字,换行,反斜杠()或一个分号隔开. ...

  3. alpine安装更新

    apk search libaio apk add make cmake libaio-dev libffi-dev glib-dev glib

  4. Kuhn-Munkres算法 (剪辑)(备用)

    KM算法是通过给每个顶点一个标号(叫做顶标)来把求最大权匹配的问题转化为求完备匹配的问题的. 设顶点Xi的顶标为A[i],顶点Yi的顶标为B[i],顶点Xi与Yj之间的边权为w[i,j]. 在算法执行 ...

  5. Luogu-4048 [JSOI2010]冷冻波

    考虑网络流,二分时间,源点向巫妖连流量为攻击次数的边,把每个巫妖向他能打的小精灵连一条流量为一的边,每个小精灵向汇点连一条边. 预处理每个小精灵能被那些巫妖打,这道题好像视线与树相切也算能打(雾. # ...

  6. EntityFramework 学习 一 Add Entity Graph using DbContext:

    //Create student in disconnected mode Student newStudent = new Student() { StudentName = "New S ...

  7. EntityFramework 学习 一 实体类型

    我们为已存在的数据库创建EDM,EDM包含与数据库中表对应的实体.EF中有两种实体类型 POCO entity dynamic proxy entity POCO Entity (Plain Old ...

  8. HDU 1255 覆盖的面积 (线段树扫描线+面积交)

    自己YY了一个的写法,不过时间复杂度太高了,网上的想法太6了  题意:给你一些矩阵,求出矩阵的面积并 首先按照x轴离散化线段到线段树上(因为是找连续区间,所以段建树更加好做). 然后我们可以想一下怎样 ...

  9. JAVA- 切换默认的Java

    删除自带的java yum remove java java -version发现还有java,因为电脑上安装了多个版本的java,这时我们可以用 yum groupremove java 通过组的这 ...

  10. node路由访问,中间件返回数据

    node路由访问,中间件返回数据 定义一个变量存放json数据,中间件接受数据 var responseData; router.use(function(req, res, next) { resp ...