I realize Anko (and Kotlin) are both pretty cutting edge but I was hoping someone might be able to give me a little guidance on this. This is just a learning project for me, of course.
I've got the following Kotlin code (using Anko) only very slightly modified from the sample code:
verticalLayout {
    padding = dip(30)
    val name = editText {
        hint = "Name"
        textSize = 24f
    }
    val password = editText {
        hint = "Password"
        textSize = 24f
        inputType = android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD
    }
    button("Login") {
        textSize = 26f
        onClick {
        toast("Good afternoon, ${name.text}!")
        }
    }
}
Everything's building and displaying but I can't seem to get the password editText to mask the input as I'm typing it in. What am I missing?
The right way is:
editText {
    inputType = TYPE_CLASS_TEXT or TYPE_TEXT_VARIATION_PASSWORD
}
Actually you have to Reference it from InputType like this:
editText { 
    inputType = InputType.TYPE_TEXT_VARIATION_PASSWORD
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With