• Android学习第四天


    TextView主要用于在界面上显示一段文本信息。
    <TextView
    android:id="@+id/textView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:textColor="#00ff00"
    android:textSize="24sp"
    android:text="This is TextView"/>  

     Button是程序用于和用户进行交互的一个重要控件。
    <Button
    android:id="@+id/button"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Button" />
    button.setOnClickListener {
    // 在此处添加逻辑

    EditText是程序用于和用户进行交互的另一个重要控件,它允许用户在控件里输入和编辑内容,并
    可以在程序中对这些内容进行处理。
    <EditText
    android:id="@+id/editText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Type something here"
    />

    ImageView是用于在界面上展示图片的一个控件,它可以让我们的程序界面变得更加丰富多彩。
    <ImageView
    android:id="@+id/imageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/img_1"
    />

    ProgressBar用于在界面上显示一个进度条,表示我们的程序正在加载一些数据。
    <ProgressBar
    android:id="@+id/progressBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    />

    AlertDialog可以在当前界面弹出一个对话框,这个对话框是置顶于所有界面元素之上的,能够屏
    蔽其他控件的交互能力,因此AlertDialog一般用于提示一些非常重要的内容或者警告信息。
    AlertDialog.Builder(this).apply {
    setTitle("This is Dialog")
    setMessage("Something important.")
    setCancelable(false)
    setPositiveButton("OK") { dialog, which ->
    }
    setNegativeButton("Cancel") { dialog, which ->
    }
    show()
    }

  • 相关阅读:
    VMware VSAN 设计规则
    通过命令行给 XenServer 打补丁
    XenServer 根分区空间满的解决办法
    sftp命令不被识别
    windows cmd窗口提示“telnet”命令不能内部或外部命令,也不是可运行的程序
    Eclipse安装ModelGoon控件(ModelGoon控件反向生成UML)
    WINDOWS8.1安装ORACLE客户端及配置
    CentOs下安装maven
    centos下安装java8
    mono支持gb2312
  • 原文地址:https://www.cnblogs.com/yongyuandishen/p/14865916.html
Copyright © 2020-2023  润新知