Make Android TextView Clickable like Buttons

Just like Buttons and ImageViews we can add onClickListeners to TextViews by simply adding the attribute android:onClick="myMethod" to your TextView XML tag.

And in your Java file, we can implement the method,

      android:onClick="myMethod" />
public void myMethod(View view) {



The other way,

TextView tv = (TextView) this.findViewById(;

tv.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {


Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap