0

How do I add a border to an Anko editText using a drawable.

This post How to put a border in an EditText? explains how to do with an XML layout

In an Anko DSL what do you add to this code fragment:

 editText() {
     hint = "Enter message"
     lines = 4
     maxLines = 4
     singleLine = false
     background="@drawable/file" // this is not right
 }
Bhuvanesh BS
  • 13,474
  • 12
  • 40
  • 66
jmc42
  • 359
  • 5
  • 22

1 Answers1

1

Try This

  editText(InputConstraints.PASSWORD) {
            id = R.id.saEtPassword
            hint = "Password"
            inputType = InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_PASSWORD
            singleLine = true
            padding = dip(10)
            setBackgroundResource(R.drawable.edit_bg)
            setHintTextColor(R.color.colorAccent)
        }.lparams {
            below(R.id.saEtEmail)
            width = matchParent
            height = wrapContent
        }