Android Development: How Can I Make An EditText Pl

2019-02-17 04:48发布

As the title says, I've seen EditTexts where they are just plain white with no smooth corners or orange android border when you highlight it etc.

Like it looks in this app: http://s1.appbrain.com/screen?id=-2631427781674403509&i=1

1条回答
三岁会撩人
2楼-- · 2019-02-17 05:06

You need to create a custom background 9-patch image like this one and put it to /res/drawable directory. Here is the tutorial for 9-patch images. Then you need to apply the image as a background for your EditText using android:background attribute.

Here is a sample layout xml:

<EditText
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:background="@drawable/white_bg"
    android:text="Test"
    android:layout_marginBottom="5dip" /> 

<EditText
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:background="@drawable/white_bg"
    android:text="Currently focused" />

And here is the result:

alt text

查看更多
登录 后发表回答