How can I make an EditText only two characters wide - also on a REAL DEVICE?
I am struggeling with the difference of an EditText between any emulator and any device. The EditText does just not display the same. :-( Can anyone tell me how I can limit an EditText to be just 2 characters wide?
What I did, I created a whole new Android project. I just pulled an EditText into my view and tried to play with all the different maxLength, maxWidth, etc. properties. The Edi开发者_如何学编程tText would do what I want it to do in the Emulator but as soon as I have the same app on a real device the EditText is always at least 4 or 5 characters wide. Why is this?? I tried it on Android 2.2 and also 2.3
Was anyone ever managed to have an EditText which is only 2 digits wide on a real device? If yes, please let me know how. :-)
use this
text.setFilters(new InputFilter[]{new InputFilter.LengthFilter(2)});
Why can't you fix the width of the edit text and textSize of the editText...?
ex:
<EditText android:layout_width="5dp" andorid:layout_height="wrap_content"
andorid:textSize="18dp"/>
精彩评论