本文整理匯總了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);
}
示例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}
));
}
}
示例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);
}
示例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);
}
示例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));
*/
}
示例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);
}
示例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 });
}
示例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 });
}
示例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 });
}
示例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 });
}
示例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);
}
示例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();
// }
}
示例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;
}
示例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();
}
});
}
示例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();
}