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 ??
If you want to show a strike-through text you can do it programming using PaintFlags. You can set paint flags Paint. STRIKE_THRU_TEXT_FLAG to a TextView and it will add a strike-through to the text.
A line with the exact space of the TextView will be drawn. Show activity on this post. Insert a divider, on width, start with about 200dp and go from there. Change Background color to what you want, change gravity to center horizontal.
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.
In Kotlin
tv.text = "This is text" tv.paintFlags = tv.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With