how to make text view clickable in android?

前端 未结 11 1582
轮回少年
轮回少年 2020-12-01 18:04

is it possible in android to make text view clickable if yes then how ??and if not then what will be the way for make a label clickable??i want to implement a call activit

11条回答
  •  日久生厌
    2020-12-01 18:37

    First in your java file cast your TextView by xml id

    TextView tv = (TextView)findViewById(R.Id.textView1);
    

    then,

    tv.setOnClickListener(new View.OnClickListener() {
       @Override
       public void onClick(View v) {
          // TODO Auto-generated method stub
       }
    });
    

提交回复
热议问题