码迷,mamicode.com
首页 > 其他好文 > 详细

gridview

时间:2014-08-11 18:06:42      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:android

public class HomeAdapter extends BaseAdapter
{
	public int getCount()
	{
		return names.length;
	}

	public View getView(int position, View convertView, ViewGroup parent)
	{
		View view = View.inflate(getApplicationContext(), R.layout.home_item, null);
		TextView tv = (TextView) view.findViewById(R.id.tv_homeitem_name);
		ImageView iv = (ImageView) view.findViewById(R.id.iv_homeitem_icon);
		tv.setText(names[position]);
		iv.setImageResource(icons[position]);

		return view;
	}

	public Object getItem(int position)
	{
		return null;
	}

	public long getItemId(int position)
	{
		return 0;
	}
}


private static final String names[] = { "手机防盗", "通讯卫士", "软件管理", "进程管理", "流量统计", "手机杀毒", "系统优化", "高级工具", "设置中心" };
private static final int icons[] = { R.drawable.safe, R.drawable.callmsgsafe, R.drawable.app,R.drawable.taskmanager, R.drawable.netmanager, R.drawable.trojan, R.drawable.sysoptimize,R.drawable.atools, R.drawable.settings };


gridview,布布扣,bubuko.com

gridview

标签:android

原文地址:http://blog.csdn.net/feecooling/article/details/38492903

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!