当前位置: 首页 > news >正文

免费网站收录入口花钱做网站注意些什么

免费网站收录入口,花钱做网站注意些什么,oa系统哪个品牌好,什么是线上营销和线下营销点击事件和长按事件 监听器#xff1a;专门监听控件的动作行为。只有控件发生了指定的动作#xff0c;监听器才会触发开关区执行对应的代码逻辑。按钮控件有两种常用的监听器#xff1a; 点击监听器#xff1a;通过setOnClickListener方法设置。按钮被按住少于500ms时会触…点击事件和长按事件 监听器专门监听控件的动作行为。只有控件发生了指定的动作监听器才会触发开关区执行对应的代码逻辑。按钮控件有两种常用的监听器 点击监听器通过setOnClickListener方法设置。按钮被按住少于500ms时会触发点击事件。长按监听器通过setOnLongClickListener方法设置。按钮被按住超过500ms时会触发长按事件。 点击事件 只有一个按钮 示例代码 package com.example.chapter03import android.annotation.SuppressLint import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.widget.Button import android.widget.TextView import com.example.chapter03.util.DateUtilclass ButtonClickActivity : AppCompatActivity() {SuppressLint(MissingInflatedId)override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_button_click)val tv_result: TextView findViewById(R.id.tv_result)val btn_click_single: Button findViewById(R.id.btn_click_single)btn_click_single.setOnClickListener(MyOnClickListener(tv_result)) // 实例化类的一个对象出来}// 创建一个类 MyOnClickListener 来实现 View.OnClickListener 接口class MyOnClickListener(private val tv_result: TextView) : View.OnClickListener {override fun onClick(p0: View?) {val dsec String.format(%s 您点击了按钮 %s, DateUtil.getNowTime(), (p0 as Button).text)tv_result.text dsec // kotlin不用set()也不用get()}} }?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalButtonandroid:idid/btn_click_singleandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:text指定单独的点击监听器android:textColor#000000android:textSize15sp/TextViewandroid:idid/tv_resultandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:padding5dpandroid:gravitycenterandroid:textColor#000000android:textSize15spandroid:text查看按钮点击的结果/ /LinearLayout运行结果 穿插kotlin小笔记 构造器传参 简写 class MyOnClickListener: View.OnClickListener {private val tv_result: TextViewconstructor(tv_result: TextView) {this.tv_result tv_result} }// 改进 class MyOnClickListener(private val tv_result: TextView) : View.OnClickListener {}有两个按钮 示例代码 package com.example.chapter03import android.annotation.SuppressLint import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.widget.Button import android.widget.TextView import com.example.chapter03.util.DateUtilclass ButtonClickActivity : AppCompatActivity() {SuppressLint(MissingInflatedId)override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_button_click)val tv_result: TextView findViewById(R.id.tv_result)val btn_click_single: Button findViewById(R.id.btn_click_single)btn_click_single.setOnClickListener(MyOnClickListener(tv_result)) // 实例化类的一个对象出来val btn_click_public: Button findViewById(R.id.btn_click_public)btn_click_public.setOnClickListener(MyOnClickListener(tv_result))}// 创建一个类 MyOnClickListener 来实现 View.OnClickListener 接口class MyOnClickListener(private val tv_result: TextView) : View.OnClickListener {override fun onClick(p0: View?) {val dsec String.format(%s 您点击了按钮 %s, DateUtil.getNowTime(), (p0 as Button).text)tv_result.text dsec // kotlin不用set()也不用get()}} }?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalButtonandroid:idid/btn_click_singleandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:text指定单独的点击监听器android:textColor#000000android:textSize15sp/Buttonandroid:idid/btn_click_publicandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:text指定公共的点击监听器android:textColor#000000android:textSize15sp/TextViewandroid:idid/tv_resultandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:padding5dpandroid:gravitycenterandroid:textColor#000000android:textSize15spandroid:text查看按钮点击的结果//LinearLayout结果
http://www.huolong8.cn/news/170954/

相关文章:

  • 设计师接私单网站网站策划编辑的工作内容
  • 网站推广的公司哪家好免费永久个人云服务器
  • wordpress网站备份恢复杭州萧山做网站
  • 建设企业网站企业网上银行酒泉市住房和城乡建设局网站
  • 门诊部网站建设个人网站主机选择
  • 免费建站推广晋江论坛网
  • 要想提高网站排名应该如何做wordpress 发文章 慢
  • 上传网站到百度有没有学做蛋糕的网站和视频
  • 网站后台设计教程视频晋中北京网站建设
  • 山东网站建设公司哪家权威什么是网络营销
  • 设计建设网站世界500强企业名录
  • 衡水商城网站制作php制作电影网站
  • 闵行做网站平面设计素材网站排名
  • 网站设计与建设网站ie兼容性
  • 简单网站建设课程移动网站建设生要女
  • 湖北做网站的网站商城建设实训心得
  • 做落地页的网站谁给个网站呀
  • 做图片推广的网站嘉兴网站制作平台
  • 免费网站建设创意wordpress主题innmx
  • 简单网站设计亚马逊如何做折扣网站的营销
  • 网站主机名是什么wordpress男人福利模板
  • 网络网站制作技巧网络推广和运营的区别
  • 迁安做网站中的cms润强百万网址导航
  • 网站建站收费网站域名免费
  • 创建网站的公司中国国音电商平台官网
  • 怎么做舞曲网站wordpress自适移动
  • 国外h5分享网站东莞非凡网站建设
  • 万网怎么做网站大连哪里有手机自适应网站建设维护
  • 莒县住房和建设局网站中国培训网官网
  • 做网站所需要的公司细责及条款网站ico