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 ...
随机推荐
- css3条纹边框效果
在线演示 本地下载
- CSS3垂直图标菜单
在线演示 本地下载
- Entity Framework 学习笔记(二)之数据模型 Model 使用过程
Entity Framework 数据模型 Model 创建的使用: 开发环境:VS2012 数据库:SQL Server 2008 Entity Framework 版本:6.12 下面是新建的 ...
- QQ.PC管家进程
1.家里的笔记本 WIn7x64 C:\Program Files (x86)\Tencent\QQPCMgr\12.10.19266.225\QMDL.exeC:\Program Files (x8 ...
- DBGrid1
A.ShowMessage(IntToStr(Column.Index)); B.ShowMessage(IntToStr(dbgrid1.SelectedField.Index)); .得到当前 ...
- ZSetOperations
有序集合,默认按照score升序排列,存储格式K(1)==V(n),V(1)=S(1)(K=key,V=value,S=score) 1.add(K,V,S):添加 2.count(K,Smin,Sm ...
- python-多线程趣味(锁)
接上一篇,程序员在敲代码的时候觉得无聊,无聊的时候,会想到去吃零食,那么假如一个函数: #! /usr/bin/env python #coding=utf-8 ''' ''' import time ...
- csv+jenkins+ant测试接口
1.文件目录 jmeter_test case 用于存放case,csv或者txt格式,jmeter能读取的 result_log 用于存放报告 html 存放html报告 jtl 存放jtl文件 s ...
- Java_异常_01_org.apache.commons.lang.exception.NestableRuntimeException
异常信息: The type org.apache.commons.lang.exception.NestableRuntimeException cannot be resolved. It is ...
- json-lib简单处理json和对json的简单介绍
JSON 1.json是什么? *它是js提供的一种数据交换格式 2.json的语法 *{}:是对象! >属性名必须使用双引号括起来!单引号不行!!! >属性值: *null *数值 *数 ...