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


Java SpinnerAdapter类代码示例

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


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

示例1: setAdapter

import android.widget.SpinnerAdapter; //导入依赖的package包/类
/**
    * Set an adapter for this Spinner.
    * @param adapter
    */
public void setAdapter(SpinnerAdapter adapter) {	
	if(mAdapter != null)
		mAdapter.unregisterDataSetObserver(mDataSetObserver);

       mRecycler.clear();

	mAdapter = adapter;
	mAdapter.registerDataSetObserver(mDataSetObserver);
	onDataChanged();
       
       if (mPopup != null) 
           mPopup.setAdapter(new DropDownAdapter(adapter));
       else
           mTempAdapter = new DropDownAdapter(adapter);        
}
 
开发者ID:ganeshkrishnan1,项目名称:material_fork,代码行数:20,代码来源:Spinner.java

示例2: getDropDownView

import android.widget.SpinnerAdapter; //导入依赖的package包/类
public View getDropDownView(int position, View convertView,
                            ViewGroup parent) {
    for (ListAdapter piece : getPieces()) {
        int size = piece.getCount();

        if (position < size) {
            return (((SpinnerAdapter) piece).getDropDownView(position,
                    convertView,
                    parent));
        }

        position -= size;
    }

    return (null);
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:17,代码来源:MergeSpinnerAdapter.java

示例3: onMeasure

import android.widget.SpinnerAdapter; //导入依赖的package包/类
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    SpinnerAdapter adapter = getAdapter();
    if (adapter != null && MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.AT_MOST) {
        View view = adapter.getView(getSelectedItemPosition(), null, this);
        if (view.getLayoutParams() == null)
            view.setLayoutParams(mDefaultLayoutParams);
        view.measure(widthMeasureSpec, heightMeasureSpec);
        int width = view.getMeasuredWidth();
        if (getBackground() != null) {
            getBackground().getPadding(mTempRect);
            width += mTempRect.left + mTempRect.right;
        }

        this.setMeasuredDimension(Math.min(width, MeasureSpec.getSize(widthMeasureSpec)), this.getMeasuredHeight());
    }

}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:19,代码来源:AutoResizeSpinner.java

示例4: DropDownAdapter

import android.widget.SpinnerAdapter; //导入依赖的package包/类
public DropDownAdapter(@Nullable SpinnerAdapter adapter, @Nullable Theme dropDownTheme) {
    this.mAdapter = adapter;
    if (adapter instanceof ListAdapter) {
        this.mListAdapter = (ListAdapter) adapter;
    }
    if (dropDownTheme == null) {
        return;
    }
    if (AppCompatSpinner.IS_AT_LEAST_M && (adapter instanceof ThemedSpinnerAdapter)) {
        ThemedSpinnerAdapter themedAdapter = (ThemedSpinnerAdapter) adapter;
        if (themedAdapter.getDropDownViewTheme() != dropDownTheme) {
            themedAdapter.setDropDownViewTheme(dropDownTheme);
        }
    } else if (adapter instanceof ThemedSpinnerAdapter) {
        ThemedSpinnerAdapter themedAdapter2 = (ThemedSpinnerAdapter) adapter;
        if (themedAdapter2.getDropDownViewTheme() == null) {
            themedAdapter2.setDropDownViewTheme(dropDownTheme);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:AppCompatSpinner.java

示例5: setAdapter

import android.widget.SpinnerAdapter; //导入依赖的package包/类
@Override
public void setAdapter(SpinnerAdapter adapter) {

    if (!_isFromInit) {
        _arrayAdapter = (ArrayAdapter) adapter;
        if (!TextUtils.isEmpty(_strHintText) && !_isDirty) {
            ArrayAdapter arrayAdapter = new ArrayAdapter(_context, android.R.layout
                    .simple_list_item_1, new String[]{_strHintText});
            super.setAdapter(arrayAdapter);
        } else {
            super.setAdapter(adapter);
        }

    } else {
        _isFromInit = false;
        super.setAdapter(adapter);
    }
}
 
开发者ID:hoihei,项目名称:Silectric,代码行数:19,代码来源:SearchableSpinner.java

示例6: setAdapter

import android.widget.SpinnerAdapter; //导入依赖的package包/类
/**
    * Set an adapter for this Spinner.
    * @param adapter
    */
public void setAdapter(SpinnerAdapter adapter) {
	if(mAdapter != null)
		mAdapter.unregisterDataSetObserver(mDataSetObserver);

       mRecycler.clear();

	mAdapter = adapter;
	mAdapter.registerDataSetObserver(mDataSetObserver);
	onDataChanged();

       if (mPopup != null)
           mPopup.setAdapter(new DropDownAdapter(adapter));
       else
           mTempAdapter = new DropDownAdapter(adapter);
}
 
开发者ID:XhinLiang,项目名称:MDPreference,代码行数:20,代码来源:Spinner.java

示例7: bi

import android.widget.SpinnerAdapter; //导入依赖的package包/类
public bi(SpinnerAdapter spinnerAdapter, Theme theme) {
    this.f1367a = spinnerAdapter;
    if (spinnerAdapter instanceof ListAdapter) {
        this.f1368b = (ListAdapter) spinnerAdapter;
    }
    if (theme == null) {
        return;
    }
    if (bg.f1353a && (spinnerAdapter instanceof ThemedSpinnerAdapter)) {
        ThemedSpinnerAdapter themedSpinnerAdapter = (ThemedSpinnerAdapter) spinnerAdapter;
        if (themedSpinnerAdapter.getDropDownViewTheme() != theme) {
            themedSpinnerAdapter.setDropDownViewTheme(theme);
        }
    } else if (spinnerAdapter instanceof dd) {
        dd ddVar = (dd) spinnerAdapter;
        if (ddVar.m2705a() == null) {
            ddVar.m2706a(theme);
        }
    }
}
 
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:21,代码来源:bi.java

示例8: setAdapter

import android.widget.SpinnerAdapter; //导入依赖的package包/类
@Override
public void setAdapter(SpinnerAdapter adapter) {
    // The super constructor may call setAdapter before we're prepared.
    // Postpone doing anything until we've finished construction.
    if (!mPopupSet) {
        mTempAdapter = adapter;
        return;
    }

    super.setAdapter(adapter);

    if (mPopup != null) {
        final Context popupContext = mPopupContext == null ? getContext() : mPopupContext;
        mPopup.setAdapter(new DropDownAdapter(adapter, popupContext.getTheme()));
    }
}
 
开发者ID:GigigoGreenLabs,项目名称:permissionsModule,代码行数:17,代码来源:AppCompatSpinner.java

示例9: onStart

import android.widget.SpinnerAdapter; //导入依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    nodeindex = Config.currentSelectedStation;

    SpinnerAdapter spinnerAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_dropdown_item,
            IDECFunctions.getStationsNames());
    stations_spinner.setAdapter(spinnerAdapter);
    stations_spinner.setSelection(nodeindex);

    if (input_action_send != null) {
        handleFileChosen(input_action_send);
        SimpleFunctions.debug("file was chosen");
    } else {
        SimpleFunctions.debug("File was not chosen, try to do by hand!");
    }
}
 
开发者ID:vit1-irk,项目名称:idec-mobile,代码行数:18,代码来源:FileUploadFragment.java

示例10: getDropDownView

import android.widget.SpinnerAdapter; //导入依赖的package包/类
public View getDropDownView(int position, View convertView,
                            ViewGroup parent) {
    for (ListAdapter piece : getPieces()) {
        int size=piece.getCount();

        if (position<size) {
            return(((SpinnerAdapter)piece).getDropDownView(position,
                    convertView,
                    parent));
        }

        position-=size;
    }

    return(null);
}
 
开发者ID:haodynasty,项目名称:AndroidBleManager,代码行数:17,代码来源:MergeSpinnerAdapter.java

示例11: updateGroupSpinner

import android.widget.SpinnerAdapter; //导入依赖的package包/类
private void updateGroupSpinner() {
    AppUserConfigurationHandler handler = getComponent(AppUserConfigurationHandler.KEY);
    if (handler == null) {
        Log.e(TAG, "Container not connected!");
        return;
    }

    Set<Group> allGroups = handler.getAllGroups();
    if (allGroups.size() < 1) {
        Log.i(TAG, "No groups available, yet.");
        return;
    }

    this.groups = Lists.newArrayList(Iterables.transform(allGroups, new Function<Group, String>() {
        @Override
        public String apply(Group input) {
            return input.getName();
        }
    }));
    SpinnerAdapter adapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, groups);
    spinner.setAdapter(adapter);
    spinner.setEnabled(true);
}
 
开发者ID:SecureSmartHome,项目名称:SecureSmartHome,代码行数:24,代码来源:AddNewUserDeviceFragment.java

示例12: setAdapter

import android.widget.SpinnerAdapter; //导入依赖的package包/类
public void setAdapter(SpinnerAdapter paramSpinnerAdapter)
{
  if (!this.mPopupSet) {
    this.mTempAdapter = paramSpinnerAdapter;
  }
  do
  {
    return;
    super.setAdapter(paramSpinnerAdapter);
  } while (this.mPopup == null);
  if (this.mPopupContext == null) {}
  for (Context localContext = getContext();; localContext = this.mPopupContext)
  {
    this.mPopup.setAdapter(new DropDownAdapter(paramSpinnerAdapter, localContext.getTheme()));
    return;
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:18,代码来源:AppCompatSpinner.java

示例13: onCreate

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

    // Get a cursor with all people
    Cursor c = getContentResolver().query(Contacts.CONTENT_URI,
            CONTACT_PROJECTION, null, null, null);
    startManagingCursor(c);

    SpinnerAdapter adapter = new SimpleCursorAdapter(this,
    // Use a template that displays a text view
            android.R.layout.simple_gallery_item,
            // Give the cursor to the list adatper
            c,
            // Map the NAME column in the people database to...
            new String[] {Contacts.DISPLAY_NAME},
            // The "text1" view defined in the XML template
            new int[] { android.R.id.text1 });

    Gallery g = (Gallery) findViewById(R.id.gallery);
    g.setAdapter(adapter);
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:24,代码来源:Gallery2.java

示例14: shouldVerifyOnCreate_initSpinner

import android.widget.SpinnerAdapter; //导入依赖的package包/类
@Test
public void shouldVerifyOnCreate_initSpinner() {
    List<EnvironmentModel> environments = Arrays.
        asList(newEnvironment(100, "env1"), newEnvironment(101, "env2"));

    List<GatewayModel> gateways = Arrays.
        asList(newGateway("uuid1", "1.1.1.1", 1), newGateway("uuid2", "2.2.2.2", 2));

    when(environmentService.findAll()).thenReturn(Observable.just(environments));
    when(gatewayService.findAll()).thenReturn(Observable.just(gateways));

    createWithIntent(null);

    SpinnerAdapter adapterEnvironment = spinnerDeviceEnvironment.getAdapter();
    assertFalse("should not be empty", adapterEnvironment.isEmpty());
    assertEquals("should verify first element", "env1", adapterEnvironment.getItem(0));
    assertEquals("should verify second element", "env2", adapterEnvironment.getItem(1));
    assertEquals("should select default", 0, spinnerDeviceEnvironment.getSelectedItemPosition());

    SpinnerAdapter adapterGateway = spinnerDeviceGateway.getAdapter();
    assertFalse("should not be empty", adapterGateway.isEmpty());
    assertEquals("should verify first element", "1.1.1.1:1", adapterGateway.getItem(0));
    assertEquals("should verify second element", "2.2.2.2:2", adapterGateway.getItem(1));
    assertEquals("should select default", 0, spinnerDeviceGateway.getSelectedItemPosition());
}
 
开发者ID:openwebnet,项目名称:openwebnet-android,代码行数:26,代码来源:ScenarioActivityTest.java

示例15: shouldVerifyOnCreate_initSpinner_noResult

import android.widget.SpinnerAdapter; //导入依赖的package包/类
@Test
public void shouldVerifyOnCreate_initSpinner_noResult() {
    when(environmentService.findAll()).thenReturn(Observable.just(new ArrayList<>()));
    when(gatewayService.findAll()).thenReturn(Observable.just(new ArrayList<>()));

    createWithIntent(null);

    SpinnerAdapter adapterEnvironment = spinnerDeviceEnvironment.getAdapter();
    assertFalse("should not be empty", adapterEnvironment.isEmpty());
    assertEquals("should verify first element", labelNone, adapterEnvironment.getItem(0));

    SpinnerAdapter adapterGateway = spinnerDeviceGateway.getAdapter();
    assertFalse("should not be empty", adapterGateway.isEmpty());
    assertEquals("should verify first element", labelMissingGateway, adapterGateway.getItem(0));

    verifyInitSpinnerSoundType();
}
 
开发者ID:openwebnet,项目名称:openwebnet-android,代码行数:18,代码来源:SoundActivityTest.java


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