Q:

My Edittext getting extended while typing the text

My Edittext its getting extend automatically while typing the text,Dont know what mistake i have done, please check my screen shot for exactly what my issue is, help me to find a solution. Thanks in advance. 
<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dip"
        android:gravity="center"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center" >

            <EditText
                android:id="@+id/oldpass"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/selectdate"
                android:ems="10"
                android:hint="@string/oldpass"
                android:inputType="textPassword"
                android:paddingLeft="5dip" >
            </EditText>
        </LinearLayout>

    </LinearLayout>

check my screen shot for how its extend while typing

A:

your height and weight are Wrap_content as it adjust upon the length of the text you given
change that to fixed dp length 
android:layout_width="150dp"
android:layout_height="wrap_content"

A:

It is due to this layout definition: android:layout_width="wrap_content"
You're basically telling that your EditText should fit the content. That means it will have a default size, but once you're typing in it and making it wider, it will extend according to the text it has inside.
You probably want to use android:layout_width="match_parent" to fit it to the screen, or play around with android:layout_weight to make it proportional to other layout items.

