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

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

 <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/round_view_rim"//这个是圆角用的,可以参考我之前的文章
android:orientation="horizontal"
android:padding="10dp"> <TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:gravity="left|center"
android:text="姓名" /> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|right"
android:background="@null" />
</LinearLayout>
05-10 17:02