请您参考如下方法:
整个东西不是编辑文本,而是布局。您可以按如下方式实现该效果。
Java
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/round_border">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$"
android:padding="5dp"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:hint="Enter your amount"
android:padding="5dp"/>
</LinearLayout>
@drawable/round_border is a drawable you should keep in drawable folder
Java
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="5dp"/>
<solid android:color="@android:color/holo_orange_light"/>
</shape>