Fixed Length Android Edittext

To make an EditText have a fixed length you need to add android: maxLength in <EditText> tag.

⛏️ android:MaxLength : Set an input filter to constrain the text length to the specified number. [integer]


    android:ems="10" >

The EditText will only allow 20 characters, if you try entering any further it won't get added up.

Recent Posts:

Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.