search

Home  >  Q&A  >  body text

android - EditText maxlength = 40 是限制文字为40个汉字吗

伊谢尔伦伊谢尔伦2773 days ago678

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 17:19:03

    After my testing and review, the situation mentioned by the question does not exist .
    I think the difference between the mobile phone of Samsung and Huawei’s pad is because of the size of pad Large, Samsung may not display completely.
    //======================================== =======

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/hello_world" />
        <EditText 
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:maxLength="40"
            />
            //这段代码运行在三星s7上,截图为s7

    The situation obtained is:

    I tested it several times using Chinese characters, English and punctuation marks, and there was no abnormality.

    And there are no similar situations to look up, either the questioner encountered a rare bug, or the questioner was careless.

    Link to a blog explaining maxlenght: http://blog.csdn.net/beimanglei/article/details/9317997

    reply
    0
  • Cancelreply