Hi, I've been having the same issue, using GridView with a BaseAdapter. My items are always the same type (a linearlayout of an image and a textview), so the above solution didn't help me.
I get shrunk items every once in a while, after playing a few seconds scrolling up and down, and the shrinking items appear random items from my grid. Any suggestions? On Jun 9, 4:35 pm, zohar lerman <[email protected]> wrote: > Hi Mort, > > I just tried it again and i changed getItemViewTypeCount to > getViewTypeCount and it is working as expected. > Actually it even fixed some other issues that I had with the ListView > > thanks > > On Jun 9, 10:38 am, zohar lerman <[email protected]> wrote: > > > > > Thanks for your help but it still shrink the image. > > > about the criteria: > > I have different criteria but to make it easy to explain i prefer this > > one. > > > On Jun 9, 8:56 am, mort <[email protected]> wrote: > > > > I think you should work with getItemViewType(int position) and > > > getViewTypeCount(), so Android knows there are different views for the > > > items. > > > Example (untested ugly style): > > > > public int getItemViewType(int position) { > > > if ( position == 5 ) return 1; > > > else return 0; > > > > } > > > > public int getItemViewTypeCount() { > > > return 2; > > > > } > > > > public View getView(int position, View convertView, ViewGroup parent) > > > { > > > if ( getItemViewType(position) == 1 ) { > > > return imgView; > > > } else { > > > TextView tv; > > > if ( convertView != null ) { // Do this to save memory! > > > tv = (TextView) convertView; > > > } else { > > > tv = new TextView(TestActivity.this); > > > } > > > tv.setText("Entry #"+position); > > > tv.setMinimumHeight(50); > > > tv.setBackgroundColor(Color.DKGRAY); > > > return tv; > > > } > > > > } > > > > btw: Querying a fixed position might be a bad idea in the long run. > > > Isn't there a better criteria? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

