Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I start typing my description box in EditText from the top line in Android Studio?

I have added the picture to show that my current description box does not start from the first line when I start to type, how do I make it to start from the top left corner?

Description box not starting from top left corner

<EditText
    android:id="@+id/et_message"
    android:layout_width="350dp"
    android:layout_height="150dp"
    android:layout_marginLeft="25dp"
    android:layout_marginTop="390dp"
    android:background="@color/white"/>

I have added my xml code for the description box above.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You should use android:gravity="start|top" in your EditText. for more details read here

<EditText
    android:id="@+id/et_message"
    android:layout_width="350dp"
    android:layout_height="150dp"
    android:layout_marginLeft="25dp"
    android:layout_marginTop="390dp"
    android:gravity="start|top"
    android:background="@color/white"
    android:text="@string/app_name"
    tools:ignore="MissingConstraints" />
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading