zoukankan      html  css  js  c++  java
  • 一手遮天 Android

    项目地址 https://github.com/webabcd/AndroidDemo
    作者 webabcd

    一手遮天 Android - kotlin: hello world

    示例如下:

    /kotlin/HelloWorld.kt

    package com.webabcd.androiddemo.kotlin
    
    import androidx.appcompat.app.AppCompatActivity
    import android.os.Bundle
    import com.webabcd.androiddemo.R
    import kotlinx.android.synthetic.main.activity_kotlin_helloworld.*
    
    class HelloWorld : AppCompatActivity() {
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.activity_kotlin_helloworld)
    
            button1.setOnClickListener {
                textView1.text = "hello world";
            }
        }
    }
    
    

    /layout/activity_kotlin_helloworld.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    
        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAllCaps="false"
            android:text="click me"/>
    
    </LinearLayout>
    
    

    项目地址 https://github.com/webabcd/AndroidDemo
    作者 webabcd

  • 相关阅读:
    202104-2 邻域均值
    202104-1 灰度直方图
    1384. 饲料调配
    1381. 阶乘
    264. 丑数 II
    1380. 邮票
    42 新安装的idea必备设置
    41 cmd中解除被占用的端口
    40 文件在线预览
    39 进度条使用
  • 原文地址:https://www.cnblogs.com/webabcd/p/android_kotlin_HelloWorld.html
Copyright © 2011-2022 走看看