Activity--弹出底部窗口
第一步 : 退出时候的布局文件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--弹出底部窗口的更多相关文章
- 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)问题, ...
- 用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 ...
随机推荐
- Java进阶学习:log4j的学习和使用
Java进阶学习——log4j的学习和使用 简介Loj4j Log4j的组成 Log4j主要由三大组组件构成: Logger: 负责生成日志,并能够对日志信息进行分类筛选,通俗的讲就是决定什么日志信息 ...
- Spring Cloud之Eureka环境搭建
pom: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.o ...
- 封装 oschina.net 表情选择
1. [代码]jquery.facial.js //从OSCHINA.NET 提取出来的 表情选择 插件 by zhouxiang //如果有不满足的地方 可以自己改改 没事随便写写的 style 和 ...
- 分享一个关于R语言黄皮书的网站!
这个网站上有许多关于R语言黄皮书的系列书籍,而且都是免费的望珍惜 http://bbs.pinggu.org/thread-870446-1-1.html
- Fireworks(whole page)
<!DOCTYPE HTML> <html> <head> <title>Canvas 实现放烟花特效</title> <meta c ...
- 英语发音规则---J字母
英语发音规则---J字母 一.总结 一句话总结: j只发[dʒ]音:jeep [dʒiːp] n. :jail [dʒeɪl] n. jeep [dʒiːp] n. 吉普车 jar [dʒɑː] n. ...
- linux没有eth0
1.创建ifcfg-eth0 touch /etc/sysconfig/network-scripts/ifcfg-eth0 2.配置ifcfg-eth0 DEVICE=eth0 HWADDR=:0c ...
- node.js抓取网上图片保存到本地
用到两个模块,http和fs var http = require("http");var fs = require("fs"); var server = h ...
- 有關WCF一個自認爲比較經典的博客
无废话WCF入门教程四[WCF的配置文件] (http://www.cnblogs.com/iamlilinfeng/archive/2012/10/02/2710224.html) -------- ...
- C#操作计划任务
昨天有一个任务,就是要下载相关文件,然后保存在相关路径下,这个没什么难度,所以就略过不谈,主要谈谈定时下载,即每天某个固定时间执行下载,这个功能我是用C#代码来操作windows自带的任务计划来实现的 ...