Inside fragment for kotlin sample would help someone
textViewStatus.setTextColor(ContextCompat.getColor(context!!, R.color.red))
if you use databinding;
bindingView.textViewStatus.setTextColor(ContextCompat.getColor(context!!, R.color.red))
Where bindingView is initialized in onCreateView like this
private lateinit var bindingView: FragmentBookingHistoryDetailBinding
bindingView = DataBindingUtil.inflate(inflater, R.layout.your_layout_xml, container, false)