Android EditText組件drawableLeft屬性設置的圖片和hint設置的文字之間的距離


 有的時候,我們需要在文本框里放置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="請輸入手機號碼"/>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM