How to make android EditText smaller than default in height?
If I change the height, I can't see my text, but it has extra blank on bottom.
How to make android EditText smaller than default in height?
If I change the height, I can't see my text, but it has extra blank on bottom.
Is it an option to explicitly set the height?
If yes, use something like
You can decrease the font size, by using
android:textSize
in XML. You can also make your control scrollable.Edit: Just saw your screenshots, what is the layout in which you have put the EditText? It may be setting non-explicit layout rules for your control.
change the XML edit text these two property
I wasn't really satisfied with any of the answers there though when combined they mostly contain all the ingredients to the right solution. But let's first identify what is the problem. The problem is as bhatt4982 stated the padding and he has provided a solution to that. Set padding to what ever you want. If you also want a smaller font do something like learn_andrd suggests or something like this
Now, the width of the EditText element is right and the font size matches that of your regular TextView. The color is however inverse as light grey don't look too good on white background. And that brings us to the last of our problems, the background. You need to set a different background because the default EditText background has a minimum height. That height is the height of the current height of the element. AFAIK Android doesn't support scaling down background images. You should define your own background Drawable for the EditText that allows heights smaller than what the default one allows. Otherwise it will have no effect what so ever no matter what you try to set for the height or padding or maring.
P.S. You might wonder why they have made it so difficult for you to create smaller EditViews... perhaps it has something to do with the fact that, even as it is, it is very difficult to use your finger to move the cursor to a specific position in the EditText (say for fixing a typo without erasing everything) element. It will become impossible if you make the text even smaller. Thus, you should probably reconsider is it, what your trying to achieve, really something worth pursuing unless your just trying to cut down on the padding.
Use
For further reference, see this : http://developer.android.com/guide/topics/ui/themes.html
EditText has a default padding set.
Try this,