Skip to content

textVisiblePassword inputType #69

@adelpuva

Description

@adelpuva
android:inputType="textVisiblePassword"

doesn't work, the characters remain hidden.I need them for a keyboard with characters and numbers.

I fixed it this way:

package com.mypackage

import android.content.Context
import android.util.AttributeSet

class PinEntryEditText : com.alimuzaffar.lib.pin.PinEntryEditText {
    constructor(context: Context?) : super(context)
    constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
    constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    )

    override fun setInputType(type: Int) {
        super.setInputType(type)
        setMask(null)
    }

}
    <com.mypackage.PinEntryEditText
        android:id="@+id/code"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:cursorVisible="false"
        android:layoutDirection="ltr"
        android:maxLength="10"
        android:textIsSelectable="false"
        app:pinBackgroundDrawable="@drawable/pin_code"
        app:pinCharacterSpacing="4dp"/>
class MyFragment : Fragment() {
       override fun onActivityCreated(state: Bundle?) {
             super.onActivityCreated(savedInstanceState)
             code.inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
      }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions