首页>代码>Android源码高仿大众点评第二版下载>/Android应用源码高仿大众点评第二版/高仿大众点评源码/MyAnjoyoLiuxiaowei/src/com/anjoyo/adapter/SearchMoreAdapter.java
package com.anjoyo.adapter;

import com.anjoyo.liuxiaowei.R;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * 查找中的更多的界面中右边listview的适配器
 * @author 苦涩
 *
 */

public class SearchMoreAdapter extends BaseAdapter {
	private Context ctx;
	private String[] text;
	private int position = 0;
	private int layout = R.layout.search_more_morelist_item;

	public SearchMoreAdapter(Context ctx, String[] text) {
		this.ctx = ctx;
		this.text = text;
	}

	public SearchMoreAdapter(Context ctx, String[] text, int layout) {
		this.ctx = ctx;
		this.text = text;
		this.layout = layout;
	}

	public int getCount() {
		return text.length;
	}

	public Object getItem(int arg0) {
		return text[arg0];
	}

	public long getItemId(int arg0) {
		return arg0;
	}

	public View getView(int arg0, View arg1, ViewGroup arg2) {
		Holder hold;
		if (arg1 == null) {
			hold = new Holder();
			arg1 = View.inflate(ctx, layout, null);
			hold.txt = (TextView) arg1
					.findViewById(R.id.Search_more_moreitem_txt);
			hold.layout = (LinearLayout) arg1
					.findViewById(R.id.More_list_lishi);
			arg1.setTag(hold);
		} else {
			hold = (Holder) arg1.getTag();
		}
		hold.txt.setText(text[arg0]);
		hold.layout.setBackgroundResource(R.drawable.my_list_txt_background);
		hold.txt.setTextColor(Color.parseColor("#FF666666"));
		if (arg0 == position) {
			hold.layout
					.setBackgroundResource(R.drawable.search_more_morelisttop_bkg);
			hold.txt.setTextColor(Color.parseColor("#FFFF8C00"));
		}
		return arg1;
	}

	public void setSelectItem(int i) {
		position = i;
	}

	private static class Holder {
		LinearLayout layout;
		TextView txt;
	}
}
最近下载更多
另类清晨  LV8 2023年11月7日
yyyyyyzh  LV8 2023年6月11日
200171  LV9 2023年6月1日
dingruiasdad  LV3 2023年4月11日
2754137495  LV6 2023年3月29日
海绵宝宝哈哈  LV2 2022年12月7日
361424231  LV4 2022年6月23日
wanghsm  LV4 2022年6月19日
zzzzzz8  LV4 2022年6月13日
alexstory  LV6 2022年6月3日
最近浏览更多
wxb666  LV3 3月13日
666ing  LV2 2023年12月27日
adyxhss  LV2 2023年12月25日
qxs110  LV1 2023年12月25日
不止是六位数  LV7 2023年12月21日
vanweiai2023 2023年11月30日
暂无贡献等级
郑唯希 2023年11月28日
暂无贡献等级
另类清晨  LV8 2023年11月7日
拜托你仔细听  LV3 2023年9月21日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友