Android first ImageView in vertical LinearLayout stretching -


the current popup

i'm creating above popup, content of consists of rows of horizontal linearlayout views within main vertical linearlayout. each horizontal linearlayout contains 1 imageview , 1 textview. i'm creating within popupwindow, , doing programmatically can change imageview source required.

as can see first icon seems take lot of space, despite having same code generating other icons.

below code:

 linearlayout verticallayout = new linearlayout(context);         verticallayout.setorientation(linearlayout.vertical); linearlayout.layoutparams mainlayoutparams =                 new  linearlayout.layoutparams(viewgroup.layoutparams.match_parent, viewgroup.layoutparams.match_parent); verticallayout.setlayoutparams(mainlayoutparams);  linearlayout.layoutparams layoutparams =                 new  linearlayout.layoutparams(viewgroup.layoutparams.match_parent, viewgroup.layoutparams.wrap_content); linearlayout.layoutparams iconparams =                 new  linearlayout.layoutparams(viewgroup.layoutparams.wrap_content, viewgroup.layoutparams.match_parent); linearlayout.layoutparams textparams =                 new linearlayout.layoutparams(viewgroup.layoutparams.wrap_content, viewgroup.layoutparams.wrap_content);  //history row linearlayout historylayout = new linearlayout(context); historylayout.setlayoutparams(layoutparams); historylayout.setorientation(linearlayout.horizontal); imageview historyicon = new imageview(context); historyicon.setimageresource(r.drawable.small_book_grey); historyicon.setadjustviewbounds(true); historyicon.setlayoutparams(iconparams); historylayout.addview(historyicon); textview historytext = new textview(context); historytext.setlayoutparams(textparams); historytext.settext("history"); historylayout.addview(historytext); verticallayout.addview(historylayout);  //exam row... //... (duplicate of history row) 

i've tried playing around layout parameters, creating mock xml layout displays content i'd like, match parameters to. if can give advice on making book icon same size others, i'd grateful.

add scaletype imageview of fitcenter


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -