Search code examples
androidtextview

draw line through text in textview


I have started to make an application similar to concept of "To do task manager", in which i need to make a textview cancelable, like, when user clicks on done image, whole text in the view will be cancelled.

Can anyone please guide me on, how to achieve this mechanism ??


Solution

  • This can help you.

        TextView tv = (TextView) findViewById(R.id.mytext);
        tv.setText("This is strike-thru");
        tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    

    You can use it in your code,however necessary.