zoukankan      html  css  js  c++  java
  • android performClick使用

    performClick 是使用代码主动去调用控件的点击事件(模拟人手去触摸控件)
    -----------------------------------------
    boolean android.view.View.performClick()

    Call this view's OnClickListener, if it is defined.

    Returns:
    True there was an assigned OnClickListener that was called, false otherwise is returned.
    ---------------------------------------------
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);
    btn1 = (Button) findViewById(R.id.button1);
    tv1 = (TextView) findViewById(R.id.textView1);
    btn1.performClick();
    btn1.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
    tv1.setText("已经被点击过了");
    }
    });

    }

    上述方式写,tv1的文字就是默认文字,仅仅有把setOnClickListener的声明写在performClick后面,直接执行程序才干显示“已被点击过了”
  • 相关阅读:
    centos安装openssl
    centos安装tomcat
    centos安装jdk文件
    shell常用命令
    linux命令: Netstat
    unix-软件安装
    页面校验方式
    软件性能的几个术语指标
    亚马逊的技术架构是怎么样的
    数据挖掘-什么是数据挖掘
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/4054913.html
Copyright © 2011-2022 走看看