当前位置: 首页>>代码示例>>Java>>正文


Java SimpleAdapter类代码示例

本文整理汇总了Java中android.widget.SimpleAdapter的典型用法代码示例。如果您正苦于以下问题:Java SimpleAdapter类的具体用法?Java SimpleAdapter怎么用?Java SimpleAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleAdapter类属于android.widget包,在下文中一共展示了SimpleAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FillLists

import android.widget.SimpleAdapter; //导入依赖的package包/类
void FillLists() {
    // We use a - sign to tell that this text should be stiked through
    SimpleAdapter.ViewBinder vb = new SimpleAdapter.ViewBinder() {
        public boolean setViewValue(View view, Object data, String textRepresentation) {
            TextView tv = (TextView) view;
            tv.setText(textRepresentation.substring(1));
            if(textRepresentation.substring(0, 1).equals("-")) {
                tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
            }
            return true;
        }
    };
  
    ArrayList<HashMap<String, String>> feedList;
    feedList = createAlertsMap(false);
    SimpleAdapter simpleAdapterLow = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent});
    simpleAdapterLow.setViewBinder(vb);

    listViewLow.setAdapter(simpleAdapterLow);

    feedList = createAlertsMap(true);
    SimpleAdapter simpleAdapterHigh = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent});
    simpleAdapterHigh.setViewBinder(vb);
    listViewHigh.setAdapter(simpleAdapterHigh);
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:xDrip-Experimental,代码行数:26,代码来源:AlertList.java

示例2: setEntries

import android.widget.SimpleAdapter; //导入依赖的package包/类
@Override
public void setEntries(CharSequence[] entries) {
	super.setEntries(entries);
	if (mDialog != null) {
		ArrayList<HashMap<String, CharSequence>> listItems = new ArrayList<>();
		for (CharSequence entry : entries) {
			HashMap<String, CharSequence> map = new HashMap<>();
			map.put("item", entry);
			listItems.add(map);
		}
		mDialog.getListView().setAdapter(new SimpleAdapter(
				mContext,
				listItems,
				R.layout.select_dialog_singlechoice_material,
				new String[] {"item"},
				new int[]{android.R.id.text1}
		));
	}
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:20,代码来源:ListPreferenceCompat.java

示例3: onCreate

import android.widget.SimpleAdapter; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_exchange_rmb_quotation);
StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary));
       btnICBC = forceCast(findViewById(R.id.btnICBC));
       btnCMB = forceCast(findViewById(R.id.btnCMB));
       btnCCB = forceCast(findViewById(R.id.btnCCB));
       btnBOC = forceCast(findViewById(R.id.btnBOC));
       btnBCM = forceCast(findViewById(R.id.btnBCM));
       btnABC = forceCast(findViewById(R.id.btnABC));
       tvTittle = forceCast(findViewById(R.id.tvTittle));
       lvResult = forceCast(findViewById(R.id.lvResult));

       btnICBC.setOnClickListener(this);
       btnCMB.setOnClickListener(this);
       btnCCB.setOnClickListener(this);
       btnBOC.setOnClickListener(this);
       btnBCM.setOnClickListener(this);
       btnABC.setOnClickListener(this);

       //init data
       adapter = new SimpleAdapter(this, dataList, R.layout.view_exchange_rmb_quotation_item,
               new String[]{"bankName", "bank", "currencyName", "currencyCode", "fBuyPri", "mBuyPri", "fSellPri", "mSellPri", "bankConversionPri", "date", "time"},
               new int[]{R.id.tvBankName, R.id.tvBankCode, R.id.tvCurrencyName, R.id.tvCurrencyCode, R.id.tvFBuyPri, R.id.tvMBuyPri, R.id.tvFSellPri, R.id.tvMSellPri, R.id.tvBankConversionPri, R.id.tvDate, R.id.tvTime});
       lvResult.setAdapter(adapter);
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:27,代码来源:QueryRMBQuotationByBank.java

示例4: onCreate

import android.widget.SimpleAdapter; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_lottery);
StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary));
       etPeriod = forceCast(findViewById(R.id.etPeriod));
       tvDateTime = forceCast(findViewById(R.id.tvDateTime));
       tvName = forceCast(findViewById(R.id.tvName));
       tvSales = forceCast(findViewById(R.id.tvSales));
       tvPool = forceCast(findViewById(R.id.tvPool));
       tvPeriod = forceCast(findViewById(R.id.tvPeriod));
       tvLotteryNumber = forceCast(findViewById(R.id.tvLotteryNumber));

       GridView gvLotteryList = forceCast(findViewById(R.id.gvLotteryList));
       ListView lvLotteryResult = forceCast(findViewById(R.id.lvLotteryAward));
       gvLotteryList.setOnItemClickListener(this);

       //init data
       updateLotteryInfo(null, null, null, null, null, null);

       lotteryTypeList = new ArrayList<HashMap<String, Object>>();
       lotteryTypeListAdapter = new SimpleAdapter(this, lotteryTypeList, android.R.layout.simple_list_item_1, new String[]{"name"}, new int[]{android.R.id.text1});
       gvLotteryList.setAdapter(lotteryTypeListAdapter);

       lotteryResultList = new ArrayList<HashMap<String, Object>>();
       lotteryResultAdapter = new LotteryResultAdapter(this, lotteryResultList);
       lvLotteryResult.setAdapter(lotteryResultAdapter);

       //获取彩种列表
       ((Lottery) forceCast(MobAPI.getAPI(Lottery.NAME))).queryLotteryList(LotteryAPIActivity.this);
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:31,代码来源:LotteryAPIActivity.java

示例5: init

import android.widget.SimpleAdapter; //导入依赖的package包/类
private void init() {
    ListView search_list = (ListView) findViewById(R.id.search_list);

    SimpleAdapter adapter = new SimpleAdapter(this,
            getLocationList(),
            R.layout.item_location_favorites,
            new String[]{"name", "detail", "item_type"},
            new int[]{R.id.location_name, R.id.location_detail, R.id.item_type_icon});
    search_list.setAdapter(adapter);

    /*
    search_box = (EditText) findViewById(R.id.search_box);
    search_box.addTextChangedListener(this);

    clear_progress_btn = (ImageView) findViewById(R.id.clear_progress_icon);
    clear_progress_btn.setOnClickListener(this);
    clear_progress_btn.setImageDrawable(null);

    mPlaceAPI = new PlaceOpenAPI(this, WeiboData.APP_KEY, WeiboData.readAccessToken(this));
    */
}
 
开发者ID:sherlockchou86,项目名称:yphoto,代码行数:22,代码来源:LocationSearchActivity.java

示例6: onCreate

import android.widget.SimpleAdapter; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(android.R.layout.list_content);
    List<Map<String, String>> list = new ArrayList<Map<String, String>>();
    HashMap<String, String> ntext = new HashMap<String, String>();
    ntext.put("name", "this.name = (data.time > data.id) && (data.time >= 3)");
    list.add(ntext);
    HashMap<String, String> page = new HashMap<String, String>();
    page.put("name", "PageScrollScript");
    page.put("class", ComponentActivity.class.getName());
    page.put("data", "component_demo/page_item.json");
    list.add(page);
    HashMap<String, String> click = new HashMap<String, String>();
    click.put("name", "ClickScript");
    click.put("class", ComponentActivity.class.getName());
    list.add(click);
    ListAdapter listAdapter = new SimpleAdapter(this, list, android.R.layout.simple_list_item_1, new String[]{"name"}, new int[]{android.R.id.text1});
    setListAdapter(listAdapter);
}
 
开发者ID:alibaba,项目名称:Virtualview-Android,代码行数:21,代码来源:ScriptListActivity.java

示例7: getSimpleAdapter_1

import android.widget.SimpleAdapter; //导入依赖的package包/类
/**
 * 设置第一列数据
 */
private SimpleAdapter getSimpleAdapter_1() {
	listData = new ArrayList<Map<String, String>>();

	Map<String, String> map = new HashMap<String, String>();
	map.put("text", "账户设置");
	listData.add(map);

	map = new HashMap<String, String>();
	map.put("text", "个人资料");
	listData.add(map);

	return new SimpleAdapter(mContext, listData,
			R.layout.setting_list_item, new String[] { "text" },
			new int[] { R.id.tv_list_item });

}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:20,代码来源:UserSettingFragment.java

示例8: getSimpleAdapter_2

import android.widget.SimpleAdapter; //导入依赖的package包/类
/**
 * 设置第二列数据
 */
private SimpleAdapter getSimpleAdapter_2() {
	listData2 = new ArrayList<Map<String, String>>();

	Map<String, String> map = new HashMap<String, String>();
	map.put("text", "屏蔽发现");
	listData2.add(map);

	map = new HashMap<String, String>();
	map.put("text", "会员介绍");
	listData2.add(map);

	map = new HashMap<String, String>();
	map.put("text", "意见反馈");
	listData2.add(map);

	map = new HashMap<String, String>();
	map.put("text", "小嗨帮助");
	listData2.add(map);


	return new SimpleAdapter(mContext, listData2,
			R.layout.setting_list_item, new String[] { "text" },
			new int[] { R.id.tv_list_item });

}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:29,代码来源:UserSettingFragment.java

示例9: getSimpleAdapter_1

import android.widget.SimpleAdapter; //导入依赖的package包/类
/**
	 * 设置第一列数据
	 */
	private SimpleAdapter getSimpleAdapter_1() {
		listData = new ArrayList<Map<String, String>>();
		
		mProvinceArr = this.getResources().getStringArray(R.array.province);
		
		for(int i = 0;i < mProvinceArr.length;i++)
		{
			Map<String, String> map = new HashMap<String, String>();
			map.put("text", mProvinceArr[i]);
			listData.add(map);
		}

//		Map<String, String> map = new HashMap<String, String>();
//		map.put("text", "账户设置");
//		listData.add(map);
//
//		map = new HashMap<String, String>();
//		map.put("text", "个人资料");
//		listData.add(map);

		return new SimpleAdapter(EditProvinceActivity.this, listData,
				R.layout.province_list_item, new String[] { "text" },
				new int[] { R.id.tv_province_list_item });

	}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:29,代码来源:EditProvinceActivity.java

示例10: getSimpleAdapter_1

import android.widget.SimpleAdapter; //导入依赖的package包/类
/**
	 * 设置第一列数据
	 */
	private SimpleAdapter getSimpleAdapter_1() {
		listData = new ArrayList<Map<String, String>>();
		
		mProvinceArr = this.getResources().getStringArray(R.array.province);
		
		for(int i = 0;i < mProvinceArr.length;i++)
		{
			Map<String, String> map = new HashMap<String, String>();
			map.put("text", mProvinceArr[i]);
			listData.add(map);
		}

//		Map<String, String> map = new HashMap<String, String>();
//		map.put("text", "账户设置");
//		listData.add(map);
//
//		map = new HashMap<String, String>();
//		map.put("text", "个人资料");
//		listData.add(map);

		return new SimpleAdapter(RegProvinceActivity.this, listData,
				R.layout.province_list_item, new String[] { "text" },
				new int[] { R.id.tv_province_list_item });

	}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:29,代码来源:RegProvinceActivity.java

示例11: onCreate

import android.widget.SimpleAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // One-time singleton initialization; requires activity context to get file location.
    ContentManager.initialize(this);

    setListAdapter(new SimpleAdapter(this, createActivityList(),
            android.R.layout.two_line_list_item, new String[] { TITLE, DESCRIPTION },
            new int[] { android.R.id.text1, android.R.id.text2 } ));

    ContentManager cm = ContentManager.getInstance();
    if (!cm.isContentCreated(this)) {
        ContentManager.getInstance().createAll(this);
    }

    ActivityCompat.requestPermissions(this, PERMISSIONS, 1);
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:20,代码来源:MainActivity.java

示例12: onCreate

import android.widget.SimpleAdapter; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        String path = intent.getStringExtra(APP_PATH);

        if (path == null) {
            path = "";
        }

        setListAdapter(new SimpleAdapter(this, getData(path),
                android.R.layout.simple_list_item_1, new String[] { "title" },
                new int[] { android.R.id.text1 }));
        getListView().setTextFilterEnabled(true);

//        String testStr = "<sss > <sss> <贷款及覅> dfsh <a > ksdjfk </a>";
//        HtmlFormater.stripHtmlTagByJsoup(testStr);

//        NumberFormat nf = NumberFormat.getPercentInstance();
//        try {
//            nf.parse("0");
//        } catch (ParseException e) {
//            e.printStackTrace();
//        }
    }
 
开发者ID:yangjiantao,项目名称:AndroidUiKit,代码行数:26,代码来源:HomeActivity.java

示例13: onCreateView

import android.widget.SimpleAdapter; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
		Bundle savedInstanceState) {
	View v = inflater.inflate(R.layout.fragment_buy_ticket_info, null);
	lvInfos = (ListView) v.findViewById(R.id.buyTicketInfo_lvInfos);
	MyDatabase myDB = new MyDatabase(this.getActivity());
	mAdapter= new SimpleAdapter(this.getActivity(), mLstDatas, R.layout.item_buy_ticket_info,
			new String[]{MyDatabase.KEY, MyDatabase.VALUE},
			new int[]{R.id.item_buy_ticket_info_tvQuestion, R.id.item_buy_ticket_info_tvAnswer}
			);
	lvInfos.setAdapter(mAdapter);
	myDB.closeDB();
	notifyAdapterDataChanged(myDB.getTicketInfos(0));
	MyUtils.setListViewHeightBasedOnChildren(lvInfos);  //设置ListView全部显示
	ViewGroup.LayoutParams params = lvInfos.getLayoutParams();
	
	params.height += 3000;   //方法不太准,人为校正高度
	lvInfos.setLayoutParams(params);
	sv1 = (ScrollView)v.findViewById(R.id.buyTicketInfo_sv1);
	sv1.smoothScrollTo(0, 20);
	return v;
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:23,代码来源:BuyTicketInfoFragment.java

示例14: initViews

import android.widget.SimpleAdapter; //导入依赖的package包/类
private void initViews() {
	GridView gvIcons = (GridView) findViewById(R.id.icons);
	SimpleAdapter adapter = new SimpleAdapter(this, getIcons(),
			R.layout.item_editimage, new String[] { "item", "resId" },
			new int[] { R.id.item_editimage_ivIcon,
					R.id.item_editimaeg_tvResId });
	gvIcons.setAdapter(adapter);
	gvIcons.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			TextView tv1 = (TextView) arg1
					.findViewById(R.id.item_editimaeg_tvResId);
			int resId = Integer.valueOf(tv1.getText().toString());
			Intent intent = new Intent();
			intent.putExtra(RESULT, resId);
			EditImageAty.this.setResult(EditImageAty.this.getIntent()
					.getIntExtra(C_RESULT_CODE, 0), intent);
			EditImageAty.this.finish();
		}
	});
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:24,代码来源:EditImageAty.java

示例15: onCreate

import android.widget.SimpleAdapter; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_ithome);

  toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setTitle(R.string.ithome);
  toolbar.setNavigationOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      ITHomeActivity.this.finish();
    }
  });
  toolbar.setOnClickListener(new DoubleClickBackToContentTopListener(this));

  refreshLayout = (SwipeRefreshLayout) findViewById(R.id.refresh_layout);
  listView = (ListView) findViewById(R.id.list_view);
  adapter = new SimpleAdapter(this, data, R.layout.list_view_item_ithome, new String[]{"title", "href"}, new int[]{R.id.title, R.id.href});
  listView.setAdapter(adapter);
  loadMoreFooter = new LoadMoreFooter(this, listView, this);

  refreshLayout.setOnRefreshListener(this);
  listView.setOnItemClickListener(this);

  refreshLayout.setRefreshing(true);
  initData();

}
 
开发者ID:tomoya92,项目名称:android-apps,代码行数:29,代码来源:ITHomeActivity.java


注:本文中的android.widget.SimpleAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。