Covering android ImageView -


while working on project found image couldn't cover whole space of imageview completely! first time have got problem this.

here code :

int imgid = getresources().getidentifier("test1", "drawable", getpackagename()); photo=new linearlayout(this); lp = new linearlayout.layoutparams(width/2,width/2); photo.setlayoutparams(lp); photo.setorientation(linearlayout.vertical); photo.setbackgroundcolor(getresources().getcolor(r.color.maingreen)); img = new imageview(this); lp = new linearlayout.layoutparams(layoutparams.match_parent,layoutparams.match_parent); img.setlayoutparams(lp); img.setbackgroundcolor(getresources().getcolor(r.color.black)); img.setimageresource(imgid); photo.addview(img); 

i have used piece of code many times before. image covered imageview's space not working well! problem? how can cover imageview completely?

img.setbackground(imgid);  //img.setimageresource(imgid); 

or

img.setbackground(imgid); img.setscaletype(imageview.scaletype.fit_xy);   img.setimageresource(imgid); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -