关于这个问题,如果只是加小图标的话,已经提供了很好的支持,drawableLeft属性就可以设置左边的小图标,类推,右边也可以

不过如果你要加的是文字,我找了下,没有相应的属性,我们只能通过转换思路去实现,我的方法是用个layout去包括一个Textview和一个Editview就可以了.

 

 1 <LinearLayout
 2             android:layout_width="match_parent"
 3             android:layout_height="wrap_content"
 4             android:layout_marginBottom="10dp"
 5             android:layout_marginTop="10dp"
 6             android:background="@drawable/round_view_rim"//这个是圆角用的,可以参考我之前的文章
 7             android:orientation="horizontal"
 8             android:padding="10dp">
 9 
10             <TextView
11                 android:layout_width="wrap_content"
12                 android:layout_height="match_parent"
13                 android:layout_marginLeft="30dp"
14                 android:layout_marginRight="30dp"
15                 android:gravity="left|center"
16                 android:text="姓名" />
17 
18             <EditText
19                 android:layout_width="match_parent"
20                 android:layout_height="wrap_content"
21                 android:layout_gravity="center|right"
22                 android:background="@null" />
23         </LinearLayout>