简体   繁体   中英

Android: Editext start of text

How do i set the starting position of the inputted text in the center or anywhere but not with the leftmost part of the editext. Thank you!

use android:paddingLeft property in the xml of EditText to displace the text from leftmost part.

android:paddingLeft="10dip" // give value according to need.

You can use android:gravity="center" too but that will place your text exactly in the middle.

use android:gravity in your layout file.

iE:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM