I am trying to set smaller height of EditText but still have not managed it. Here is my source:
<EditText android:layout_width="150dp" android:layout_height="20dp"
android:singleLine="true" android:textSize="10dp" />
This code cuts out text and a white rectangular shape appears around EditText control. I have also tried maxHeight/minHeight properties, but did not worked either. If anybody have solved this issue, please help.
Or is this is the bug开发者_如何学Python in the android? I can not even resize Spinner, same happens as with EditText.
Thanks
Irfan
You are probably seeing bizarre orange rectangular shapes within the field when testing in the emulator ?
If so then I have managed to work out some basic rule-of-thumb on size settings. Your textSize needs to be a little bigger. Try 30dp.
With some experimentation I have found that if you use "dp" and apply this rule of thumb, it should work for EditText fields.
textSize x 3= layout_height
I say rule of thumb because the minimum height before the field "breaks" again is about 29dp. So, for example if you have textSize="10dp", then layout_height="30dp", or textSize="12dp", then layout_height="36dp". You can have smaller textSizes, but it becomes illegible lower than 9dp. I found this works well in relative_layouts with default fonts.
精彩评论