Android Kotlin .visibility

I have this code to make the image visible, but I don't know how it should be written for kotlin

I'm trying to use. Visibility in kotlin. I don't know how to give it a value. It's based on setvisibility()

Code:

fun hacerVisibleLaFoto(v: View) {
    imageView.visibility = 1;
}

I put 1 at the value point because I need an integer value there, which is my placeholder value until I find the real value

=How should I make the value visible after the symbol?

resolvent:

Android has a static constant of view visibility. In order to change visibility programmatically, you should use view.visible, view.invisible or view.gone

Setting visibility using myview.visibility = myvisibility in kotlin is the same as setting visibility using myview.setvisibility (myvisibility) in Java

In your case:

fun hacerVisibleLaFoto(v: View) {
    imageView.visibility = View.VISIBLE
}

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>