android 怎么循环gridview
SoapObjectresult=(SoapObject)((SoapObject)((SoapObject)envelope.getResponse()).getPro...
SoapObject result = (SoapObject)((SoapObject)((SoapObject) envelope.getResponse()).getProperty(1)).getProperty(0);
//anyType{
//tmp=anyType{DRUG_NAME=羟苯磺酸钙胶囊(昊畅)★◆○; DRUG_FACTORY=宁夏康亚; DRUG_VALID=2015-01-01T00:00:00+08:00; DRUG_SPECIFICATION=0.25g*36; DRUG_NUB=2; DRUG_LOLCALHOST=H000009; };
//tmp=anyType{DRUG_NAME=羟苯磺酸钙胶囊(昊畅)★◆○; DRUG_FACTORY=宁夏康亚; DRUG_VALID=2016-01-01T00:00:00+08:00; DRUG_SPECIFICATION=0.25g*36; DRUG_NUB=970; DRUG_LOLCALHOST=H000009; };
//}
int count = result.getPropertyCount();
for(int i=0;i < count;i++){
result.getProperty("DRUG_NAME");
String items[]={"语文","自然", "数学","外语","体育","其他"};
for (String strText:items) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("ItemText",strText);
srcTable.add(map);
}
}
这是代码 展开
//anyType{
//tmp=anyType{DRUG_NAME=羟苯磺酸钙胶囊(昊畅)★◆○; DRUG_FACTORY=宁夏康亚; DRUG_VALID=2015-01-01T00:00:00+08:00; DRUG_SPECIFICATION=0.25g*36; DRUG_NUB=2; DRUG_LOLCALHOST=H000009; };
//tmp=anyType{DRUG_NAME=羟苯磺酸钙胶囊(昊畅)★◆○; DRUG_FACTORY=宁夏康亚; DRUG_VALID=2016-01-01T00:00:00+08:00; DRUG_SPECIFICATION=0.25g*36; DRUG_NUB=970; DRUG_LOLCALHOST=H000009; };
//}
int count = result.getPropertyCount();
for(int i=0;i < count;i++){
result.getProperty("DRUG_NAME");
String items[]={"语文","自然", "数学","外语","体育","其他"};
for (String strText:items) {
HashMap<String, String> map = new HashMap<String, String>();
map.put("ItemText",strText);
srcTable.add(map);
}
}
这是代码 展开
1个回答
展开全部
请问您的意思是填充GridView吗,如果说做出一个这样的效果来。
我的代码如下:
private int[] imgs = new int[]{R.drawable.share_xl,R.drawable.share_micb,R.drawable.share_kj,
R.drawable.share_wx,R.drawable.share_py,R.drawable.share_rr,
R.drawable.share_kx,R.drawable.share_mail,R.drawable.share_dx};
private String[] des = new String[]{"新浪微博","腾讯微博","QQ空间",
"微信","朋友圈","人人网",
"开心网","邮件","短信"};
再自定义一个适配器
class PopupShareAdapter extends BaseAdapter{
Context context;
public PopupShareAdapter(Context context) {
this.context = context;
}
@Override
public int getCount() {
return imgs.length;
}
@Override
public Object getItem(int position) {
return des[position];
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
if (convertView == null) {
holder = new Holder();
convertView = LayoutInflater.from(context).inflate(R.layout.share_item, null);
holder.img = (ImageView) convertView.findViewById(R.id.img);
holder.desc = (TextView) convertView.findViewById(R.id.des);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.img.setImageResource(imgs[position]);
holder.desc.setText(des[position]);
return convertView;
}
class Holder {
public ImageView img;
public TextView desc;
}
}
最后,给设置适配器就ok了
gridView.setAdapter(new PopupShareAdapter(context));
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询