creating a strikethrough text?

前端 未结 11 921
借酒劲吻你
借酒劲吻你 2020-11-30 17:36

Can I create a strikethrough text in Android, I mean adding a special value in the TextView tag that can make this possible?



        
11条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 18:32

    In your observable view model

    fun getStrikeContent(): String {
        return "Hello"
    }
    
    
     companion object {
        @BindingAdapter("strike")
        @JvmStatic
        fun loadOldPrice(view: TextView, value: String) {
            view.text = value
            view.paintFlags = STRIKE_THRU_TEXT_FLAG
        }
    }
    

    then in your xml

         
    

提交回复
热议问题