zoukankan      html  css  js  c++  java
  • 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()
    }

  • 相关阅读:
    适配者模式7(10)
    规范使用线程池与底层原理详解
    Java集合多线程安全
    CAS底层原理与ABA问题
    手写数字识别-小数据集
    深度学习-卷积
    Java并发编程volatile关键字
    朴素贝叶斯-垃圾邮件分类
    K均值算法
    mysql搭建主从复制(一主一从,双主双从)
  • 原文地址:https://www.cnblogs.com/yongyuandishen/p/14865916.html
Copyright © 2011-2022 走看看