Calling setCompoundDrawables() doesn't display the Compound Drawable

后端 未结 10 1032
自闭症患者
自闭症患者 2020-12-04 06:58

After I call the setCompoundDrawables method, the compound Drawable is not shown..

Drawable myDrawable = getResources().getDrawable(R.drawable.btn);
btn.setC         


        
10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 07:45

    Image is blank because it hasn't got specified bounds. You may use setCompoundDrawables() but before you should specify image's bounds, using Drawable.setBounds() method

提交回复
热议问题