android – EditText doesn't show text after set layout params programatically-ThrowExceptions

Exception or error:

When I set width and height of my edit text programatically I can’t see it. It is possible to sit that it apears above editText field. Don’t know how to fix it.


enter image description here

super.onViewCreated(view, savedInstanceState)
val display: Display = (context?.getSystemService(Context.WINDOW_SERVICE) as WindowManager).defaultDisplay
val size = Point()
val width: Int = size.x
val height: Int = size.y
window.layoutParams.height = 3*height/4
window.layoutParams.width = 2*width/3
window.x = width/2f-width/3f
window.y = height/8f
login.layoutParams.width = width/4
login.layoutParams.height = height/8
login.x = width/2 - width/8f
login.y = height/4f
login.hint = "Login"
login.isSingleLine = false
login.imeOptions = EditorInfo.IME_FLAG_NO_ENTER_ACTION
login.textSize = height/4f

fragmen.xml file:
enter link description here

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *