android - How to set the gravity of the content drawable in a TextView -
i've tried change gravity using method setgravity(gravity.top). changes gravity of text, not content drawable. content drawable displayed @ center.
update: added code snippet
textview textview = new textview(context); textview.settextappearance(context, r.style.somestyle); final layoutparams layoutparams = new layoutparams(layoutparams.match_parent, layoutparams.wrap_content); layoutparams.setmargins(margindeep, margintop, margindeep, 0); textview.setlayoutparams(layoutparams); textview.setcompounddrawablepadding(margindefault); textview.settext(hugetext); textview.setcompounddrawableswithintrinsicbounds(drawable, 0, 0, 0); textview.setgravity(gravity.top);
check documentation can use drawableright, drawablebottom etc... in xml
Comments
Post a Comment