开发者

Android EditText look

I wanna make the editText to look like this:

Android EditText look

what else should I do after I set 开发者_StackOverflowthe editText's background how can I make the text start inside the edittext via code.


Are you trying to get the EditText to say "Username" by default, but not have that be the actual text?

For that you can use EditText.setHint() (inherited from TextView) or in the xml definition use android:hint, such as

<EditText 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="Username" />


To make text look like that, set the Gravity attribute to left. The gravity of EditText element.


As well as setting the background of the EditText view, set left and right padding, e.g.

<EditText 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/edittext_bg"
    android:paddingLeft="7dp"
    android:paddingRight="7dp" />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜