有的時候,我們需要在文本框里放置icon圖片,並且設置默認提示文字的時候,需要設置兩者之間的間距,如下圖:
這里想設置的就是之前的手機icon和”請輸入手機號“之間的距離,則可是使用以下的方式:
<EditText android:id="@+id/tel_num" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="25dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:drawablePadding="8dp" android:drawableLeft="@drawable/phone" android:hint="請輸入手機號碼"/>