本文整理汇总了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;
}
}
示例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;
}
}
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
}
}
示例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;
}
示例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());
}
}
示例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;
}
}
}
示例9: setAdapter
import android.widget.SpinnerAdapter; //导入方法依赖的package包/类
public void setAdapter(SpinnerAdapter adapter) {
if (adapter.getCount() > 0) {
lastPosition = 0;
}
spinner.setAdapter(adapter);
}