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

    performClick 使用代码是主动调用控件的Click事件(去触摸控件)
    -----------------------------------------
    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后,直接执行才艺表演“它已被点击了”
  • 相关阅读:
    tp5后台开发某些心得
    some note
    py数据抓取小案例(博客
    vue axios的使用
    C# WebApi POST 提交
    WebApi 返回Json
    C# WebApi 处理Area路径问题
    时间比较
    将多行数据合并为一列
    汉字转换拼音
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/4568827.html
Copyright © 2011-2022 走看看