Relative Content

Tag Archive for androidxmlkotlin

Android: Two Horizontal Side by Side Textview not managing the same height

I’m encountering a problem with TextView height adjustment in my Android application. When I select a quantity of one, only “Tamara” is displayed and the view appears correctly. However, when I change the quantity to three, both “Tabby” and “Tamara” are enabled and displayed perfectly. The issue arises when I change the quantity back to one; the height seems to be based on the previous selection when both “Tabby” and “Tamara” were visible.

How to reference a string resource in Kotlin activity, not XML

In Android Studio, I made a new Kotlin activity and a .xml file to go along with it. I know in the xml file having hardcoded text is bad, and you should use this answer to reference a string resource instead. I have code in my Kotlin activity that checks if a user submitted a proper email, and gives an error message if it is not valid. I don’t want to hardcode the error message, so I try to reference a string resource like before, but it doesn’t work. How do I reference the strings in strings.xml in a Kotlin activity, not another .xml file?