當前位置: 首頁>>代碼示例>>Java>>正文


Java ResourceCursorAdapter類代碼示例

本文整理匯總了Java中android.support.v4.widget.ResourceCursorAdapter的典型用法代碼示例。如果您正苦於以下問題:Java ResourceCursorAdapter類的具體用法?Java ResourceCursorAdapter怎麽用?Java ResourceCursorAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ResourceCursorAdapter類屬於android.support.v4.widget包,在下文中一共展示了ResourceCursorAdapter類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SpinnerHelper

import android.support.v4.widget.ResourceCursorAdapter; //導入依賴的package包/類
public SpinnerHelper(Spinner spinner, int loaderID, ResourceCursorAdapter adapter, @LayoutRes int dropDownLayout, OnItemSelectedListener onSelected) {
    Spinner = spinner;
    mLoaderID = loaderID;
    Spinner.setOnItemSelectedListener(onSelected);
    Spinner.setAdapter(adapter);
    adapter.setDropDownViewResource(dropDownLayout);

}
 
開發者ID:SelvinPL,項目名稱:SyncFrameworkAndroid,代碼行數:9,代碼來源:SpinnerHelper.java

示例2: onActivityCreated

import android.support.v4.widget.ResourceCursorAdapter; //導入依賴的package包/類
@Override
public void onActivityCreated(final Bundle savedInstanceState)
{
	super.onActivityCreated(savedInstanceState);

	setEmptyText(getString(R.string.exchange_rates_fragment_empty_text));

	adapter = new ResourceCursorAdapter(activity, R.layout.exchange_rate_row, null, true)
	{
		@Override
		public void bindView(final View view, final Context context, final Cursor cursor)
		{
			final ExchangeRate exchangeRate = ExchangeRatesProvider.getExchangeRate(cursor);
			final boolean isDefaultCurrency = exchangeRate.currencyCode.equals(defaultCurrency);

			view.setBackgroundResource(isDefaultCurrency ? R.color.bg_less_bright : R.color.bg_bright);

			final View defaultView = view.findViewById(R.id.exchange_rate_row_default);
			defaultView.setVisibility(isDefaultCurrency ? View.VISIBLE : View.INVISIBLE);

			final TextView currencyCodeView = (TextView) view.findViewById(R.id.exchange_rate_row_currency_code);
			currencyCodeView.setText(exchangeRate.currencyCode);

			final CurrencyTextView rateView = (CurrencyTextView) view.findViewById(R.id.exchange_rate_row_rate);
			rateView.setPrecision(Constants.LOCAL_PRECISION);
			rateView.setAmount(WalletUtils.localValue(Utils.COIN, exchangeRate.rate));

			final CurrencyTextView walletView = (CurrencyTextView) view.findViewById(R.id.exchange_rate_row_balance);
			walletView.setPrecision(Constants.LOCAL_PRECISION);
			walletView.setAmount(WalletUtils.localValue(balance, exchangeRate.rate));
			walletView.setStrikeThru(Constants.TEST);
			walletView.setTextColor(getResources().getColor(R.color.fg_less_significant));
		}
	};
	setListAdapter(adapter);

	loaderManager.initLoader(0, null, this);
}
 
開發者ID:goldcoin,項目名稱:goldcoin-android,代碼行數:39,代碼來源:ExchangeRatesFragment.java


注:本文中的android.support.v4.widget.ResourceCursorAdapter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。