MultiLine EditText in Android with the cursor starting on top

android, android-edittext, android-layout

Solution

<EditText
        android:id="@+id/txtContacto"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:gravity="top"
        android:inputType="textMultiLine" 
        android:weight="1">
    </EditText>

try the above code.. where layout gravity sets the edittext and gravity sets the content of edittext.

Problem

I know it seems it's an already thousand times answered issue but I haven't found anything that works for me. I have a MultiLine EditText on Android that adapts to the view size by "playing" with the weight (1) and the height (0dip). I am using gravity "top" but it starts in the middle. I guess the problem it's related with the weight. Here's the code (the parent is a LinearLayout): ``` <EditText android:id="@+id/txtContacto" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_gravity="top" android:inputType="textMultiLine" android:weight="1"> </EditText> ```

Original source

Related problems