开发者

Android: Editext start of text

开发者 https://www.devze.com 2023-03-10 02:24 出处:网络
How do i set the starting position of the inputted text in the ce开发者_C百科nter or anywhere but not with the leftmost part of the editext. Thank you! use android:paddingLeft property in the xml of E

How do i set the starting position of the inputted text in the ce开发者_C百科nter 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.

i.E.:

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

精彩评论

暂无评论...
验证码 换一张
取 消