17

I have this EditText and Button, and I have to reduce its height. I try with android:height="10px" but it doesn't work. Btw android:width="180px" works OK, then I don't know why I can't adjust the height.

Here is the code:

<EditText 
    android:id="@+id/Movile"
    android:layout_alignBaseline="@+id/MovileLabel"
    android:layout_alignParentRight="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:width="180px"
    android:height="10px"/>

<Button
        android:id="@+id/inviteButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/invite"
        android:width="100px"
        android:height="5px"
        android:layout_marginLeft="40dip"/>
Jonas
  • 121,568
  • 97
  • 310
  • 388
NullPointerException
  • 36,107
  • 79
  • 222
  • 382
  • possible duplicate of [How to make android EditText smaller than default in height?](http://stackoverflow.com/questions/1361332/how-to-make-android-edittext-smaller-than-default-in-height) – Jonas Nov 10 '10 at 15:41
  • 1
    Have you tried setting `android:textSize` to the size of the text you want it to be? – Bryan Denny Nov 10 '10 at 15:20

4 Answers4

23

Instead of setting values to android:height="10px" use android:layout_height="10px"

 android:layout_width="180px"
 android:layout_height="10px"
tomash
  • 12,742
  • 15
  • 64
  • 81
Labeeb Panampullan
  • 34,521
  • 28
  • 94
  • 112
7

use android:minHeight="120dp" attribute.

if need to increase height dynamically add android:layout_height="wrap_content"

Janith
  • 355
  • 1
  • 4
  • 8
6

You need to get rid of the "wrap_content" properties and just have the fixed width and height as so:

<EditText 
    android:id="@+id/Movile"
    android:layout_alignBaseline="@+id/MovileLabel"
    android:layout_alignParentRight="true"
    android:layout_width="180px"
    android:layout_height="10px"/>

<Button
        android:id="@+id/inviteButton"
        android:text="@string/invite"
        android:layout_width="100px"
        android:layout_height="5px"
        android:layout_marginLeft="40dip"/>
Parag Chauhan
  • 35,760
  • 13
  • 86
  • 95
bassburner
  • 620
  • 1
  • 6
  • 15
1

You can't decrase size of TextEdit if the font is too big inside.

try android:textSize='6sp'

yosh
  • 3,245
  • 7
  • 55
  • 84