android - Set icon on button center position through programatically -
i want set icon on button on center place through programatically above diagram please 1 me...
may helps you..
set background image button in drawable folder use below code:
btn.setbackgroundresource(r.drawable.image);
or
btn.setbackgrounddrawable(getresources().getdrawable(r.drawable.image));
or use: setcompounddrawablewithintrinsicbounds().
look more regarding setcompounddrawablewithintrinsicbounds()
in documentation : click here
edit:
try way: setcompounddrawablewithintrinsicbounds(r.drawables.minus,0,0,0);
add line in xml: android:paddingleft="100dp"
Comments
Post a Comment