的EditText身高问题 [英] EditText Height Issue
问题描述
我想设置的EditText较小的高度,但还没有做的。下面是我的源:
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" />
这code切出的文本和一个白色的长方形周围出现的EditText控制。我也尝试了maxHeight /性能了minHeight,但没有任何工作。如果有人已经解决了这个问题,请大家帮忙。
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.
或者,这是在android的错误?我甚至不能调整微调,同样的情况,与EditText上。
Or is this is the bug in the android? I can not even resize Spinner, same happens as with EditText.
感谢
伊尔凡
推荐答案
你可能看到奇怪的橙色矩形领域内,在模拟器中进行测试时?
You are probably seeing bizarre orange rectangular shapes within the field when testing in the emulator ?
如果是的话,我已经成功地制定出一些基本规则 - 拇指大小的设置。你TEXTSIZE需要大些。尝试30dp。
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.
通过一些实验,我发现,如果使用DP和运用这个经验法则,它应该工作的EditText领域。
With some experimentation I have found that if you use "dp" and apply this rule of thumb, it should work for EditText fields.
TEXTSIZE×3 = layout_height
textSize x 3= layout_height
我说的经验法则,因为领域的休息前的最小高度再次约29dp。因此,举例来说,如果你有TEXTSIZE =10dp,然后layout_height =30dp,或TEXTSIZE =12dp,然后layout_height =36dp。你可以有更小的textSizes,但它变得比9dp难以辨认低。我发现这个效果很好relative_layouts使用默认字体。
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.
这篇关于的EditText身高问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!