Resources/drawable 下新增如下文件:

push_bottom_in.xml

<?xml version="1.0" encoding="utf-8" ?>
<!-- 上下滑入式 -->
<set xmlns:android="http://schemas.android.com/apk/res/android" > <translate
android:duration=""
android:fromYDelta="100%p"
android:toYDelta=""
/>
</set>

push_buttom_out.xml

<?xml version="1.0" encoding="utf-8" ?>
<!-- 上下滑出式 -->
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration=""
android:fromYDelta=""
android:toYDelta="98%p" />
</set>

在 values/Styles.xml 新增如下样式

  <style name="AnimBottom" parent="@android:style/Animation">
<item name="android:windowEnterAnimation">@drawable/push_bottom_in</item>
<item name="android:windowExitAnimation">@drawable/push_buttom_out</item>
</style> <style name="MyDialogStyleBottom" parent="android:Theme.Holo.DialogWhenLarge">
<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>

新增如下文件 Resources/layout/LoginMenuPopupWindow.axml

<?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="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:id="@+id/pop_layout"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:background="#EEE"
android:layout_width="match_parent">
<Button
android:id="@+id/btn_smsloginauthentication_loginmenupopupwindow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="通过短信验证登陆"
android:background="@drawable/v_line"
android:textColor="@color/fonts_color" />
<Button
android:id="@+id/btn_changepassword_loginmenupopupwindow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="修改密码"
android:background="@drawable/v_line"
android:textColor="@color/fonts_color" />
<Button
android:id="@+id/btn_cancel"
android:layout_marginTop="10dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="取消"
android:textColor="@color/fonts_color"
android:background="@drawable/top_line" />
</LinearLayout>
</RelativeLayout>

对应的Activity 代码 LoginMenuPopupWindow.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using static Android.Views.View; namespace Dorid
{
[Activity(Theme = "@style/MyDialogStyleBottom")]
public class LoginMenuPopupWindow : Activity, IOnClickListener
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.LoginMenuPopupWindow); var windowManager = WindowManager;
var windowManagerLayoutParams = Window.Attributes;
var displayMetrics = new Android.Util.DisplayMetrics();
windowManager.DefaultDisplay.GetMetrics(displayMetrics);
windowManagerLayoutParams.Width = (int)(displayMetrics.WidthPixels * ); // 宽度设置
Window.Attributes = windowManagerLayoutParams; var btn_cancel = FindViewById<Button>(Resource.Id.btn_cancel);
var btn_changepassword = FindViewById<Button>(Resource.Id.btn_changepassword_loginmenupopupwindow);
var btn_smsloginauthentication = FindViewById<Button>(Resource.Id.btn_smsloginauthentication_loginmenupopupwindow); btn_cancel.SetOnClickListener(this);
btn_changepassword.SetOnClickListener(this);
btn_smsloginauthentication.SetOnClickListener(this);
// Create your application here
} public void OnClick(View v)
{
Intent intent = new Intent();
switch (v.Id)
{
case Resource.Id.btn_smsloginauthentication_loginmenupopupwindow:
intent.PutExtra("Type", "SmsLogin");
SetResult(Result.Ok, intent);
break;
case Resource.Id.btn_changepassword_loginmenupopupwindow:
intent.PutExtra("Type", "ChangePassword");
SetResult(Result.Ok, intent);
break;
case Resource.Id.btn_cancel:
default: break;
}
Finish();
} public override bool OnTouchEvent(MotionEvent e)
{
Finish();
return base.OnTouchEvent(e);
}
}
}

xamarin.android 实现 Activity 底部弹出对话框菜单的更多相关文章

  1. Android仿IOS底部弹出选择菜单ActionSheet

    使用Dialog的实现方式,解决原ActionSheet使用Fragment实现而出现的部分手机取消按钮被遮盖的问题 java部分代码: import android.app.Dialog; impo ...

  2. Android使用Activity用作弹出式对话框

    转载请表明出处:http://blog.csdn.net/lmj623565791/article/details/23116115 Android中可用于实现对话框的有Dialog,PopupWin ...

  3. Android BottomSheet:底部弹出Fragment面板(4)

     Android BottomSheet:底部弹出Fragment面板(4) BottomSheet不仅可以弹出轻量级的定制好的面板(见附录文章5,6,7),还可以弹出"重"的 ...

  4. 拍照选择图片(Activity底部弹出)

    效果图如下: 第一步 : 显示出的布局文件:alert_dialog.xml <?xml version="1.0" encoding="utf-8"?& ...

  5. Android广播接收器里弹出对话框

    不多说,直接上车... public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(fina ...

  6. Android仿ios底部弹出框效果

    准备: public class ActionSheet { public interface OnActionSheetSelected { void onClick(int whichButton ...

  7. AndroidSweetSheet:从底部弹出面板(1)

     AndroidSweetSheet:从底部弹出面板(1) AndroidSweetSheet又是一个从底部弹出面板的开源项目.我在以前写的文章中介绍了不少这些项目,见附录文章5,6,7,8.现在 ...

  8. Android 底部弹出Dialog(横向满屏)

    项目中经常需要底部弹出框,这里我整理一下其中我用的比较顺手的一个方式(底部弹出一个横向满屏的dialog). 效果图如下所示(只显示关键部分): 步骤如下所示: 1.定义一个dialog的布局(lay ...

  9. 转 android 从底部弹出一个popuwindow,渐入渐出效果。我这里是用在购物车需要选择购买选项的操作。

    最近要改客户端,需要实现一个从底部弹出的popuwindow,像我这种渣渣android技术,能整出popuwindow但是整不出动画,百度之,记录一下. 从下面这个地址转的 http://blog. ...

随机推荐

  1. Sticky Fingure安装教程

    作者:小离 官方对应Sticky Finger Kali-Pi 的介绍: Sticky Fingers Kali-Pi – The pocket size, finger friendly, lean ...

  2. zookeeper集群环境搭建详细图文教程

    zookeeper集群环境搭建详细图文教程 zhoubang @ 2018-01-02 [文档大纲] 友情介绍 软件环境 注意点 环境安装 1. 新建用于存储安装包以及软件安装的目录 2. 下载安装z ...

  3. 【bzoj3224】【Tyvj 1728】 普通平衡树 树状数组

    您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:1. 插入$x$数2. 删除$x$数(若有多个相同的数,因只删除一个)3. 查询$x$数的排名(若有多个相同的数,因输出最小 ...

  4. 直接插入排序实现(Java)

    直接插入排序介绍 直接插入排序的基本操作是将一个记录插入到已经排好序的有序表中,从而得到一个新的.记录数增1的有序表.     怎么理解呢?就是将n个待排序的元素看成一个有序表和一个无序表,开始时有序 ...

  5. VSTO学习(六)——创建Outlook解决方案

    本专题概要 引言 Outlook对象模型 自定义Outlook窗体 小结 一.引言 在上一个专题中,为大家简单介绍了下如何创建Word解决方案的,所以本专题中将为大家介绍下Outlook相关的内容.我 ...

  6. (转)教你手工mysql拆库

    原文:http://www.cnblogs.com/cchust/p/3859967.html 互联网网站应用大多采用mysql作为DB存储,限于mysql单机性能的瓶颈,为了支撑更大容量和更大的访问 ...

  7. 关于符号Symbol第一篇

    Symbol类的一个实例代表一个符号.对于语法树来说,并不是每个节点都有一个符号实例.下面列举了哪些语法树节点具有符号的引用,如下表格: 其中JCNewClass.JCAssignOp.JCUnary ...

  8. warning: already initialized constant FileUtils::VERSION

    Ran into this, and the solution here works: https://stackoverflow.com/questions/51334732/rails-5-2-0 ...

  9. 中小团队基于Docker的devops实践

    笔者所在的技术团队负责了数十个项目的开发和维护工作,每个项目都至少有dev.qa.hidden.product四个环境,数百台机器,在各个系统之间疲于奔命,解决各种琐碎的问题,如何从这些琐碎的事情中解 ...

  10. 一次tomcat数据乱码事件

    一次环境变量出错导致的tomcat数据乱码事件 1.1 事件起因 由于业务的调整,我们需要将在A服务器上的后台系统迁移到B服务器上的后台,我们选择在下班后进行迁移,因为那个时间点,后台系统已经几乎没有 ...