zoukankan      html  css  js  c++  java
  • 第一课 Hello

    using System;
    using Android.App;
    using Android.Content;
    using Android.Runtime;
    using Android.Views;
    using Android.Widget;
    using Android.OS;
    using Android.Util;
     
    namespace MyLesson
    {
        [Activity(Label = "Lesson1", MainLauncher = true, Icon = "@drawable/icon")]
        public class Lesson1 : Activity
        {
            int count = 1;
            TextView tv;
     
            protected override void OnCreate(Bundle bundle)
            {
                base.OnCreate(bundle);
                LinearLayout layout = new LinearLayout(this);
                layout.Orientation = Orientation.Vertical;
                tv = new TextView(this);
                tv.Text = "Hello";
                Button b = new Button(this);
                b.Text = "Click me";
                b.Click += b_Click;
     
                layout.AddView(tv);
                layout.AddView(b);
                SetContentView(layout);
            }
     
            void b_Click(object sender, EventArgs e)
            {
                tv.Text = "Click times:" + count;
                count++;
            }
        }
    }
     
    程序员喜欢的方式,纯代码方式。
  • 相关阅读:
    判断浏览器是否安装ActiveX控件
    浏览器判断及IE版本区分
    获取应用程序根目录
    C#读取csv通用类
    office文档转Txt文档
    合理使用.NET异常处理
    iis操作
    vim配置
    Spring的Annotation使用注意
    JdbcTemplate API备忘
  • 原文地址:https://www.cnblogs.com/catzhou/p/3579895.html
Copyright © 2011-2022 走看看