1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question Edittext-view cuts letters in height

Discussion in 'Android Questions' started by Roger C, Apr 29, 2019.

  1. Roger C

    Roger C Active Member Licensed 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.

    Attached Files:

  2. klaus

    klaus Expert Licensed User

    Without seeing your code, impossible to give a concrete advice!
    The most efficient way to help you, would be if you posted your project as a zip file.
    So we could see what exactly you have done and how.
  3. Roger C

    Roger C Active Member Licensed 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.

    Attached Files:

  4. Roger C

    Roger C Active Member Licensed 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?

    Attached Files:

  5. klaus

    klaus Expert Licensed 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.

    Attached Files:

    Last edited: May 2, 2019
    Erel likes this.
  6. Roger C

    Roger C Active Member Licensed User

    Thank you so much Klaus!

    I'll stick with the bigger textheight for now.

    Have a nice evening.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice