Android – kotlin view setenabled function missing?
•
Android
In kotlin, when using kotlinx.android.synthetic to access a view (such as a button), the setenabled() function is missing? The isenabled() function still exists
How can I setenabled()?
resolvent:
As described in the reference, Java getters and getter and setter pairs are represented as attributes in kotlin, using the following logic:
>T getsomething() (void setssomething (T)) → things: T > t isssomething() (void setssomething (T)) → isssomething: t
If there is a setter, you can see the VaR attribute from kotlin, otherwise it is an immutable val
Instead of setenabled (value), simply use isenabled = value
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
二维码