i have a gridview layout, and all items are insert very fine,
now if I check on big screen then all work done is fine, because no scrolling is required
but if I check on small screen then items are changed their position dynamically,
bereif example is given below:-
like I have 28 items and arranged in a grid view 7*4, now if upto 20 items are shown in first screen, now remaining 8 is shown while i scroll screen down, but now some elements of first or second row is aslo put in last row.
code is here
public class ImageAdapter extends BaseAdapter
{
Context mContext;
//public static final int ACTIVITY_CREATE = 10;
public ImageAdapter(Context c)
{
mContext = c;
}
@Override
public int getCount()
{
// TODO Auto-generated method stub
return providers.length;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
// TODO Auto-generated method stub
View v;
if(convertView==null)
{
LayoutInflater li = getLayoutInflater();
v = li.inflate(R.layout.icontext, null);
TextView tv = (TextView)v.findViewById(R.id.icon_text);
tv.setText(providers[position]);
ImageView iv = (ImageView)v.findViewById(R.id.icon_image);
iv.setImageResource(R.drawable.icon);
}
else
{
v = convertView;
}
return v;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…