Search code examples
androidwidgettextviewstrikethrough

Is there an easy way to strike through text in an app widget?


I was wondering if there is an easy way to strike text within an app widget in Android. In a normal activity, it is pretty easy, using textview flags:

textView.setPaintFlags(textView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);

But since in an app widget, I can use only remoteviews... I do not know if this is possible

Anyone know something about this?

Thanks!


Solution

  • You can use this:

    remoteviews.setInt(R.id.YourTextView, "setPaintFlags", Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
    

    Of course you can also add other flags from the android.graphics.Paint class.