android - Stretch image of button image from code -



android - Stretch image of button image from code -

i'm programatically adding imagebuttons layout, problem can't command size of images retrieved database results in of them beingness small. i'd know if there's way define image button stretch displayed image.

for(datamodel m : list){ imagebutton btn = new imagebutton(this); byte[] convert = base64.decode(m.getimage(), base64.default ); btn.setimagebitmap(bitmapfactory.decodebytearray(convert, 0, convert.length)); btn.setid(integer.parseint(m.getfoodid())); btn.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // later } }); btn.setlayoutparams(new layoutparams(layoutparams.fill_parent,200)); ((linearlayout) layout).addview(btn); }

you can utilize setscaletype method of imageview

btn.setscaletype(imageview.scaletype.fit_xy);

android

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -