How to click or tap on a TextView text

后端 未结 8 1702
無奈伤痛
無奈伤痛 2020-11-27 09:52

I know this is so easy (doh...) but I am looking for a way to run a method on tapping or clicking a TextView line of text in an Android App.

I keep thinking about bu

8条回答
  •  伪装坚强ぢ
    2020-11-27 10:16

    You can use TextWatcher for TextView, is more flexible than ClickLinstener (not best or worse, only more one way).

    holder.bt_foo_ex.addTextChangedListener(new TextWatcher() {
    
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                // code during!
    
            }
    
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                // code before!
    
            }
    
            @Override
            public void afterTextChanged(Editable s) {
                // code after!
    
            }
        });
    

提交回复
热议问题