1. 程式人生 > >更改控件中DrawableLeft圖片的大小,圖片與文字的距離

更改控件中DrawableLeft圖片的大小,圖片與文字的距離

ddr 參數 lai plain 設置 draw com 獲取圖片 color

Drawable drawable=getResources().getDrawable(R.drawable.xx); //獲取圖片

  drawable.setBounds(left, top, right, bottom); //設置圖片參數   xx.setCompoundDrawablesRelativeWithIntrinsicBounds(null,all,null,null); //設置到哪個控件的位置() 圖片與文字距離 :屬性android:drawablePadding=""

技術分享

更改控件中DrawableLeft圖片的大小,圖片與文字的距離