android - Grid View Auto fit is not showing full images -


why grid view showing images this? grid view emulator

my code:

<gridview     android:id="@+id/grid_view"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:layout_below="@+id/sbsz"   android:numcolumns="auto_fit"     android:columnwidth="90dp"     android:horizontalspacing="10dp"     android:verticalspacing="10dp"     android:gravity="center"     android:stretchmode="columnwidth" >   </gridview> 

image adapter:

 @override     public view getview(int position, view convertview, viewgroup parent) {          linearlayout linearlayout=new linearlayout(mcontext);          imageview imageview = new imageview(mcontext);          text=new textview(mcontext);          linearlayout.setorientation(linearlayout.vertical);         imageview.setimageresource(mthumbids[position]);         imageview.setscaletype(imageview.scaletype.fit_xy);         imageview.setlayoutparams(new gridview.layoutparams(270, 270));         text.settext(mthumbtxt[position]);             linearlayout.addview(imageview);           linearlayout.addview(text);         return linearlayout;     }  } 

what's wrong code? how can make show full images? shouldn't autofit it?

autofit means calculate how many 90dp wide columns can fit. should change scale type center crop, looks better. , use layoutparams image, like: imageview.setlayoutparams(new gridview.layoutparams(layoutparams.match_parent, 120));


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -