moster67 Expert Licensed User Longtime User Feb 4, 2012 #1 I am wondering if it is possible to adapt programatically the height of an editText (with multi-line enabled) according to the lines inserted in a editText-view? Let's say I need to populate an editText-view with a certain amount of words which would span over 5 lines, then I'd like that the editText adopted its height to show these 5 lines. The same goes with 3 lines - compared to the previous example, the editText would decrease its height-size. I had a look at "MeasureMultilineTextHeight" in the StringUtils-library but it seems it can only be used with labels. Edit: it seems like "MeasureMultilineTextHeight" works with editText as well. Therefore, I can probably use it to obtain what I am looking for. However, if anyone wants to share some code, please do so Any ideas? Last edited: Feb 4, 2012
I am wondering if it is possible to adapt programatically the height of an editText (with multi-line enabled) according to the lines inserted in a editText-view? Let's say I need to populate an editText-view with a certain amount of words which would span over 5 lines, then I'd like that the editText adopted its height to show these 5 lines. The same goes with 3 lines - compared to the previous example, the editText would decrease its height-size. I had a look at "MeasureMultilineTextHeight" in the StringUtils-library but it seems it can only be used with labels. Edit: it seems like "MeasureMultilineTextHeight" works with editText as well. Therefore, I can probably use it to obtain what I am looking for. However, if anyone wants to share some code, please do so Any ideas?
A admac231 Active Member Licensed User Longtime User Feb 4, 2012 #2 Code: Dim su As StringUtils editText1.Height = su.MeasureMultilineTextHeight(editText1,editText1.Text&CRLF) This has always worked for me. I don;t know if it's just my phone (Samsung Galaxy S) that requires an extra CRLF or if that's just the way it is. Upvote 0
Code: Dim su As StringUtils editText1.Height = su.MeasureMultilineTextHeight(editText1,editText1.Text&CRLF) This has always worked for me. I don;t know if it's just my phone (Samsung Galaxy S) that requires an extra CRLF or if that's just the way it is.