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


Java SpinnerAdapter.getCount方法代碼示例

本文整理匯總了Java中android.widget.SpinnerAdapter.getCount方法的典型用法代碼示例。如果您正苦於以下問題:Java SpinnerAdapter.getCount方法的具體用法?Java SpinnerAdapter.getCount怎麽用?Java SpinnerAdapter.getCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.SpinnerAdapter的用法示例。


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

示例1: getNavigationItemCount

import android.widget.SpinnerAdapter; //導入方法依賴的package包/類
@Override
public int getNavigationItemCount() {
    switch (mActionView.getNavigationMode()) {
        case NAVIGATION_MODE_TABS:
            return mTabs.size();
        case NAVIGATION_MODE_LIST:
            SpinnerAdapter adapter = mActionView.getDropdownAdapter();
            return adapter != null ? adapter.getCount() : 0;
        default:
            return 0;
    }
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:13,代碼來源:ActionBarImpl.java

示例2: setSpinnerPosition

import android.widget.SpinnerAdapter; //導入方法依賴的package包/類
private static void setSpinnerPosition(final Spinner spinner, final Object itemToSelect) {
    final SpinnerAdapter adapter = spinner.getAdapter();
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        final Object item = spinner.getItemAtPosition(i);
        if (item.equals(itemToSelect)) {
            spinner.setSelection(i);
            return;
        }
    }
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:12,代碼來源:CustomInputStylePreference.java

示例3: editRecur

import android.widget.SpinnerAdapter; //導入方法依賴的package包/類
private void editRecur(Recur recur) {
	editStartDate(recur.startDate);
	RecurInterval interval = recur.interval;
	SpinnerAdapter adapter = sInterval.getAdapter();
	int count = adapter.getCount();
	for (int i=0; i<count; i++) {
		SpinnerItem item = (SpinnerItem)adapter.getItem(i);
		if (interval == RecurInterval.valueOf(item.value)) {
			sInterval.setSelection(i);
			break;
		}
	}		
	View v = selectInterval(interval);
	switch (interval) {
	case EVERY_X_DAY:
		editEveryXDay(v, recur);
		break;
	case WEEKLY:
		editWeekly(v, recur);
		break;
	case SEMI_MONTHLY:
		editSemiMonthly(v, recur);
		break;
	}
	RecurPeriod period = recur.period;
	sPeriod.setSelection(period.ordinal());
	v = selectPeriod(period);
	switch (period) {
	case EXACTLY_TIMES:
		editExactlyTimes(v, recur.periodParam);
		break;
	case STOPS_ON_DATE:
		editStopsOnDate(v, recur.periodParam);
		break;
	}
}
 
開發者ID:tiberiusteng,項目名稱:financisto1-holo,代碼行數:37,代碼來源:RecurActivity.java

示例4: setSpinnerSelection

import android.widget.SpinnerAdapter; //導入方法依賴的package包/類
private void setSpinnerSelection(Spinner spinner, int position) {
    SpinnerAdapter adapter = spinner.getAdapter();
    if (adapter != null) {
        final int count = adapter.getCount();
        if (count > 0 && position < count) {
            spinner.setSelection(position, true);
        }
    }
}
 
開發者ID:nairbspace,項目名稱:octoandroid,代碼行數:10,代碼來源:ConnectionFragment.java

示例5: setSpinnerItemSelectedByValue

import android.widget.SpinnerAdapter; //導入方法依賴的package包/類
/**
 * ����ֵ, ����spinnerĬ��ѡ��:
 * 
 * @param spinner
 * @param value
 */
public static void setSpinnerItemSelectedByValue(Spinner spinner,
		String value) {
	SpinnerAdapter apsAdapter = spinner.getAdapter(); // �õ�SpinnerAdapter����
	int k = apsAdapter.getCount();
	for (int i = 0; i < k; i++) {
		if (value.equals(apsAdapter.getItem(i).toString())) {
			spinner.setSelection(i, true);// Ĭ��ѡ����
			break;
		}
	}
}
 
開發者ID:nighthary,項目名稱:phoneContact,代碼行數:18,代碼來源:Tools.java

示例6: selectItemOfSpinner

import android.widget.SpinnerAdapter; //導入方法依賴的package包/類
private void selectItemOfSpinner( Spinner spinner , String s )
{
    SpinnerAdapter adapter = spinner.getAdapter();
    int max = adapter.getCount();
    for( int i=0;i<max;i++ ){
        String item = (String)adapter.getItem(i);
        if ( s.equals(item) ){
            spinner.setSelection(i);
            break;
        }
    }
    return;
}
 
開發者ID:jiro-aqua,項目名稱:JotaTextEditor,代碼行數:14,代碼來源:FileSelectorActivity.java

示例7: onMeasure

import android.widget.SpinnerAdapter; //導入方法依賴的package包/類
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    int selectedPosition = getSelectedItemPosition();
    SpinnerAdapter adapter = getAdapter();
    if (selectedPosition >= 0 && adapter != null && selectedPosition < adapter.getCount()) {
        View view = adapter.getView(selectedPosition, null, this);
        measureChild(view, widthMeasureSpec, heightMeasureSpec);
        float padding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, ARROW_PADDING,
                getResources().getDisplayMetrics());
        setMeasuredDimension(Math.min((int) (view.getMeasuredWidth() + padding),
                MeasureSpec.getSize(widthMeasureSpec)), getMeasuredHeight());
    }
}
 
開發者ID:googlesamples,項目名稱:attendee-checkin,代碼行數:15,代碼來源:FlexSpinner.java

示例8: setSpinnerSelection

import android.widget.SpinnerAdapter; //導入方法依賴的package包/類
void setSpinnerSelection(String notebookSummary){
    Spinner spinner = (Spinner) activity.findViewById(R.id.spinner_notebook);
    SpinnerAdapter adapter = spinner.getAdapter();
    for(int i=0;i<adapter.getCount();i++){
        String nbsummary = adapter.getItem(i).toString();
        if(nbsummary.equals(notebookSummary)){
            spinner.setSelection(i);
            break;
        }
    }
}
 
開發者ID:konradrenner,項目名稱:kolabnotes-android,代碼行數:12,代碼來源:DetailFragment.java

示例9: setAdapter

import android.widget.SpinnerAdapter; //導入方法依賴的package包/類
public void setAdapter(SpinnerAdapter adapter) {
    if (adapter.getCount() > 0) {
        lastPosition = 0;
    }
    spinner.setAdapter(adapter);
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:7,代碼來源:SpinnerHelper.java


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