I want to decrease the use of binding in my code
fun setVisibility() {
binding.tvFact.visibility = View.VISIBLE
binding.tvTimeStamp.visibility = View.VISIBLE
binding.progressBar.visibility = View.GONE
}
If you do not like the syntax try this:
binding.apply{
tvFact.visibility = View.VISIBLE
tvTimeStamp.visibility = View.VISIBLE
progressBar.visibility = View.GONE
}
You can set these values in XML itself
as default ones, so it won't process each time to set it.
<View
...
android:visibility="gone">
</>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.