I need to show a large number of EditText controls on a screen, each of which will only allow entering 0-2 digits. The default EditText size is too wide for me to show enough EditText controls on a screen, but I have been unable to figure out how to make them narrower. I have tried the following attributes in XML: android:maxLength="2" android:layout_width="20dip" android:maxWidth="20px" android:ems="2" android:maxEms="2". So the question is: how can EditText be made smaller than default?
That actually looks about as wide as the default to me. How does it look if you have just two characters in the EditText?
Heikki Toivonen
2009-03-17 08:10:29
OK, I see what you mean now. With no width specified, the whole width of the text is used for the default up to the width of the screen.
Feet
2009-03-17 08:26:30
Ah, got it. My problem was that I had the controls in a table, and changing just one made no change. Once I changed them ALL I saw the changes.
Heikki Toivonen
2009-03-19 05:29:36
+1
A:
Hey once you try this,it may work....... android:textAppearance="?android:attr/textAppearanceSmall"
jetti
2010-01-03 06:22:19
A:
In case you end up on this page to search how to achieve the same in Java code..
txtSample.setFilters(new InputFilter[]{new InputFilter.LengthFilter(2)});
Nikhil Patil
2010-05-02 09:13:04