In response to this answer, I believe a Kotlin-styled way to accomplish this can also be written as:
fun showHide(view:View) {
view.visibility = if (view.visibility == View.VISIBLE){
View.INVISIBLE
} else{
View.VISIBLE
}
}