3.12 MonoForAndroid用户人机界面--具有交互功能的对话框
来源:互联网 发布:番茄计时器 windows 编辑:程序博客网 时间:2024/05/01 22:18
Main.axml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <Button android:id="@+id/myButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/str_button1" /></LinearLayout>
MainActivity.cs
using System;using Android.App;using Android.Content;using Android.Runtime;using Android.Views;using Android.Widget;using Android.OS;namespace Ex03_12{ [Activity(Label = "Ex03_12", MainLauncher = true, Icon = "@drawable/icon")] public class MainActivity : Activity { protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById<Button>(Resource.Id.myButton1); button.Click += delegate { new AlertDialog.Builder(this) .SetTitle(Resource.String.app_about) .SetMessage(Resource.String.app_about_msg) .SetPositiveButton(Resource.String.str_ok, handllerNotingButton) .Show(); }; } void handllerNotingButton(object sender, DialogClickEventArgs e) { AlertDialog objAlertDialog = sender as AlertDialog; Button btnClicked = objAlertDialog.GetButton(e.Which); Toast.MakeText(this, "you clicked on " + btnClicked.Text, ToastLength.Long).Show(); } }}
0 0
- 3.12 MonoForAndroid用户人机界面--具有交互功能的对话框
- 具有交互功能的对话框
- 具有交互功能的对话框
- 3.6 MonoForAndroid用户人机界面-样式化的定型对象
- 3.8 MonoForAndroid用户人机界面-手机页面的转换
- 3.10 MonoForAndroid用户人机界面--不同Activity之间的数据传递
- 3.13 MonoForAndroid用户人机界面--置换文字颜色的机关
- 3.14 MonoForAndroid用户人机界面--控制不同的文字字体
- 具有交互功能的对话框-AlertDialog窗口
- 3.4 MonoForAndroid用户人机界面-置换TextVew文字
- 3.5 MonoForAndroid用户人机界面-取得手机屏幕大小
- 3.9 MonoForAndroid用户人机界面--调用另一个Activity
- 3.16 MonoForAndroid用户人机界面--自制计算器
- 3.17 MonoForAndroid用户人机界面--关于(About)程序信息 Menu功能菜单程序设计
- 3.1 MonoForAndroid用户人机界面-更改与显示文字标签-TextView标签的使用
- [读书摘记]具有交互功能的对话框--AlertDialog窗口
- 3.2 MonoForAndroid用户人机界面-更改手机窗口画面底色
- 3.3 MonoForAndroid用户人机界面-更改TextView文字颜色
- Android适配不同分辨率——精确适配不同的dpi和屏幕尺寸
- loadrunner性能测试——入门
- tar 压缩打包时排除或忽略某个子目录或文件
- maven与findbugs
- log4j配置
- 3.12 MonoForAndroid用户人机界面--具有交互功能的对话框
- [Xamarin]测试账号申请与到期后如何续用
- 谈谈asp,php,jsp的优缺点
- Linux常用命令大全
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from
- php-fpm(PHP-FPM是一个PHPFastCGI管理器)
- 图像基本处理算法的简单实现(一)
- 如何高效地判断数组中是否包含某特定值
- ibatis 开发中的经验 (二)ibatis 命名空间配置以及左中右连接查询