Android Question Edittext-view cuts letters in height

Roger C

Active Member
Licensed User
Longtime User
Hi all,

This has probably been solved before but I can't find it anywhere if so.

My problem is that all text entered in the edittext-view is cut in top. (See pic)
I've tried different heights, separated the two views if they covered each other, experimented with padding, different anchors, different alignments, different textsize....
But nothing helps.

What am I doing wrong?
I want the usable area for text to be at least twice as high. As it is now it's only 25% of the total height of the view.
 

Attachments

  • 20190429_215813b.jpg
    20190429_215813b.jpg
    36.3 KB · Views: 339

Roger C

Active Member
Licensed User
Longtime User
Of course, sorry.

Supplied are the parts of the project concerning this Activity in zip.

Also two pics. One from the phone where the letters are cut in the middle of the View and from the Designer.

Start the app and click the button down to left ('Dina Resor').
In the new window you have two Edittext-views in middle top.

If I write something in them, I only see the bottom half of all letters.
 

Attachments

  • Cut text in edittext.zip
    151.3 KB · Views: 224
  • SL error Designer.jpg
    SL error Designer.jpg
    24.5 KB · Views: 212
  • SL error Edittext.jpg
    SL error Edittext.jpg
    76.3 KB · Views: 242
Upvote 0

Roger C

Active Member
Licensed User
Longtime User
Tried some more now and found that I need to make the Edittext twice as big as the visible part of it, overlapping other views around it.
Then it works and I can see the full letters.

As you see in the picture from Designer, the frame is the top Edittext-view (txtFrom). To make the letters work it has to be double the size of the green label to the left (lblFrom).

Is it supposed to work like this?
 

Attachments

  • SL error rezised.jpg
    SL error rezised.jpg
    58.7 KB · Views: 211
  • SL error rezised works.jpg
    SL error rezised works.jpg
    74.9 KB · Views: 220
Upvote 0

klaus

Expert
Licensed User
Longtime User
That's the way Android works.
In your case, either the EditText height is too small or the TextSize is too big.
To get a correct display you must either:
set EditText height to 40 with TextSize = 14
or set TextSize = 11 for EditText height = 30

Another suggestion for the texts near the edges, you might add some Padding to get a small space between the border line and the text.

Attached your project modified with 4 more EditText views with different property values showing the problem.
 

Attachments

  • Cut text in edittext1.zip
    151.4 KB · Views: 252
Last edited:
Upvote 0
Top