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. hello lua

    http://manual.luaer.cn/ http://www.lua.org/pil/contents.html #include <cstdio> #include <st ...

  2. JS 对象 合并

    来自:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Sy ...

  3. MYSQL NULL值特性

    NULL是一种“没有类型”的值,通常表示“无值”,“未知值”,“缺失值”,“超界”,“不在其中”等,我们在日常运用中很容易和NULL字符串混淆,这里大致整理了下NULL值的一些特性,以便能够正确使用N ...

  4. 转载,自己留着看eclipse 快捷键

    Eclipse中10个最有用的快捷键组合  一个Eclipse骨灰级开发者总结了他认为最有用但又不太为人所知的快捷键组合.通过这些组合可以更加容易的浏览源代码,使得整体的开发效率和质量得到提升.    ...

  5. OS之进程管理---多处理器调度

    引言 之前我们所学习的操作系统进程调度策略的前提条件是单处理器系统下的CPU调度程序.如果系统中存在多个CPU,那么负载分配就成为可能,但是相应的调度问题就会更加复杂. 多处理器调度方法 对于多处理器 ...

  6. POJ 2376

    #include<iostream>//by chengdacaizi. #include<stdio.h> #define MAXN 25005 using namespac ...

  7. Nginx基本入门

    转自:http://blog.csdn.net/u012486840/article/details/53098890 1.静态HTTP服务器 首先,Nginx是一个HTTP服务器,可以将服务器上的静 ...

  8. h5移动端聊天室|仿微信界面聊天室|h5多人聊天室

    今年的FIFA世界杯甚是精彩,最近兴致高涨就利用HTML5开发了一个手机端仿微信界面聊天室,该h5聊天室采用750px全新伸缩flex布局,以及使用rem响应式配合fontsize.js,页面弹窗则是 ...

  9. linux centos7 防火墙及端口开放相关命令

    一.防火墙相关命令 1.查看防火墙状态 : systemctl status firewalld.service 注:active是绿的running表示防火墙开启 2.关闭防火墙 :systemct ...

  10. (转)Python 3 collections.defaultdict() 与 dict的使用和区别

    原文:https://www.cnblogs.com/herbert/archive/2013/01/09/2852843.html 在Python里面有一个模块collections,解释是数据类型 ...