@@ Branislav-i做了和你说过的一样的东西,它对我很有用,但是没有任何图像超过9n文字,它也让我看到了同样的第一或蚂蚁随机图像和文字在第九图像的位置和文字带有图标和文字的gridview图像
public class ImageAdapter extends BaseAdapter {
private Context mContext;
public ImageAdapter(Context c) {
mContext = c;
}
public int getCount() {
return mThumbIds.length;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
View v;
if (convertView == null) { // if it's not recycled, initialize some attributes
LayoutInflater li = getLayoutInflater();
v = li.inflate(R.layout.mainmenu, null);
TextView tv = (TextView)v.findViewById(R.id.icon_text);
tv.setText(mTextsIds[position]);
ImageView iv = (ImageView)v.findViewById(R.id.icon_image);
iv.setImageResource(mThumbIds[position]);
} else {
v = (View) convertView;
}
return v;
}
private Integer[] mThumbIds = {
R.drawable.hotel1, R.drawable.rest,R.drawable.dubaicityinfoicon_new,R.drawable.history1,R.drawable.geography,R.drawable.infoicon,R.drawable.infoicon,R.drawable.infoicon,R.drawable.parkmain,
};
// references to our texts
private String[] mTextsIds = {
"Hotels","Restaurants","City Info","Dubai History","Geography Of Dubai","Useful Information","Embassies in Duabai","Museum's","park"
};
在此它回事,直到完美博物馆但公园的工作不被显示阵列mThumbIds内的任何随机图像n相关联的文本。 plz plz催促需要帮助.. ñ呀图像是可绘制的。
http://developer.android.com/resources/tutorials/views/hello-gridview.html –
@@ Dr.nik-我没有在教程中做过这样的事情say.stil面临问题 – sups