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


Java Spinner类代码示例

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

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

示例1: onDataChange

import android.widget.Spinner; //导入依赖的package包/类
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
    EditText username = (EditText)findViewById(R.id.usernameText);
    name = username.getText().toString();
    EditText password = (EditText)findViewById(R.id.passwordText);
    pass = password.getText().toString();
    Spinner grabAccountType = findViewById(R.id.accountTypeSpinner);
    String accountType = (String) grabAccountType.getSelectedItem();
    if (!(dataSnapshot.child(email).hasChild(name))) {
        if (accountType.equals("Child")) {
            newUser = new User(name, pass, MenuActivity.getManager().nextSerialNumber(), resID);
            manager.setCurrentUserId(newUser.getUserId());
            manager.addRegUser(newUser);
            fbRef.child(email).child("ChoreManager").setValue(manager);
        } else {
            newAdminUser = new AdminUser(name, pass, MenuActivity.getManager().nextSerialNumber(), resID);
            manager.setCurrentUserId(newAdminUser.getUserId());
            manager.addAdminUser(newAdminUser);
            fbRef.child(email).child("ChoreManager").setValue(manager);
        }
    }
   finish();
}
 
开发者ID:TranAlan,项目名称:Chore-Manager-App,代码行数:24,代码来源:NewUserActivity.java


示例2: onCreate

import android.widget.Spinner; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.wx_debug_activity);
    textBack = (TextView) findViewById(R.id.text_back);
    textScan = (ImageView) findViewById(R.id.text_scan);
    editHost = (EditText) findViewById(R.id.edit_host);
    editPort = (EditText) findViewById(R.id.edit_port);
    editOpen = (EditText) findViewById(R.id.edit_open);
    cbLocal = (CheckBox) findViewById(R.id.cb_local);
    cbDebugChrome = (CheckBox) findViewById(R.id.cb_debug_chrome);
    cbSRemote = (CheckBox) findViewById(R.id.cb_sRemoteDebugMode);
    btnSave = (Button) findViewById(R.id.btn_save);
    btnReset = (Button) findViewById(R.id.btn_save_reset);
    btnOpen = (Button) findViewById(R.id.btn_open);
    spinner = (Spinner) findViewById(R.id.spinner_log_level);

    textBack.setOnClickListener(this);
    textScan.setOnClickListener(this);
    btnSave.setOnClickListener(this);
    btnReset.setOnClickListener(this);
    btnOpen.setOnClickListener(this);
    setData();
    hideSoftInput();
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:26,代码来源:WXDebugActivity.java


示例3: onFinishInflate

import android.widget.Spinner; //导入依赖的package包/类
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mRadioGroup = (RadioGroup) findViewById(R.id.radio_button_group);
    mColorModeButtons.put(Theme.LIGHT,
            initializeAndGetButton(R.id.light_mode, Theme.LIGHT));
    mColorModeButtons.put(Theme.DARK,
            initializeAndGetButton(R.id.dark_mode, Theme.DARK));
    mColorModeButtons.put(Theme.SEPIA,
            initializeAndGetButton(R.id.sepia_mode, Theme.SEPIA));
    mColorModeButtons.get(mDistilledPagePrefs.getTheme()).setChecked(true);

    mFontScaleSeekBar = (SeekBar) findViewById(R.id.font_size);
    mFontScaleTextView = (TextView) findViewById(R.id.font_size_percentage);

    mFontFamilySpinner = (Spinner) findViewById(R.id.font_family);
    initFontFamilySpinner();

    // Setting initial progress on font scale seekbar.
    onChangeFontScaling(mDistilledPagePrefs.getFontScaling());
    mFontScaleSeekBar.setOnSeekBarChangeListener(this);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:DistilledPagePrefsView.java


示例4: onCreateView

import android.widget.Spinner; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    log.i("onCreateView");
    View rootView = inflater.inflate(R.layout.fragment_billing, container, false);
    txt_content = (TextView) rootView.findViewById(R.id.txt_content);
    txt_content.setText(this.getClass().getSimpleName());
    bill_type = (Spinner) rootView.findViewById(R.id.bill_type);
    bill_sku = (Spinner) rootView.findViewById(R.id.bill_sku);
    String[] testSkus = getResources().getStringArray(R.array.bill_skus);
    for (String sku : testSkus) {
        mSkuList.add(sku);
    }
    mSkuAdapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, mSkuList);
    mSkuAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    bill_sku.setAdapter(mSkuAdapter);
    return rootView;
}
 
开发者ID:vipycm,项目名称:mao-android,代码行数:18,代码来源:BillingFragment.java


示例5: onCreate

import android.widget.Spinner; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivityManager.getActivityManager().addActivity("RegisterActivity", this);
    setContentView(R.layout.activity_register);

    etName = (EditText) findViewById(R.id.ETname);
    etEmail = (EditText) findViewById(R.id.ETemail);
    spMajor = (Spinner) findViewById(R.id.spiMajor);
    spProvince = (Spinner) findViewById(R.id.spiProvince);

    etPassword = (EditText) findViewById(R.id.ETpassword);
    etConfirmPassword = (EditText) findViewById(R.id.ETconfirmPassword);
    etCheckCode = (EditText) findViewById(R.id.ETCheckCode);
    radioGroup = (RadioGroup) findViewById(R.id.rgGender);


    findViewById(R.id.butRegister).setOnClickListener(this);
    findViewById(R.id.butMailCode).setOnClickListener(this);

}
 
开发者ID:GrayXu,项目名称:HustEating,代码行数:22,代码来源:RegisterActivity.java


示例6: doLookup

import android.widget.Spinner; //导入依赖的package包/类
public void doLookup() {
    setStatusText("initializing");
    Session thisQuestion = new Session();

    //build the question object
    String qname = gettxtQNAMEContent();
    thisQuestion.qname = qname;
    thisQuestion.qtype = gettxtQTYPEContent();
    thisQuestion.flag_RD = ((CheckBox) findViewById(R.id.cbRD)).isChecked();
    thisQuestion.flag_CD = ((CheckBox) findViewById(R.id.cbCD)).isChecked();
    thisQuestion.flag_DO = ((CheckBox) findViewById(R.id.cbDO)).isChecked();
    thisQuestion.qclass = (((Spinner) findViewById(R.id.spinnerCLASS))).getSelectedItem().toString();
    thisQuestion.server = gettxtResolverContent().trim();
    thisQuestion.TCP = ((CheckBox) findViewById(R.id.cbTCP)).isChecked();
    doLookup(thisQuestion);
}
 
开发者ID:gryphius,项目名称:androdns,代码行数:17,代码来源:DNSFormActivity.java


示例7: onFinishInflate

import android.widget.Spinner; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    tvAmountA = (TextView) findViewById(R.id.tvAmountA);
    tvAmountB = (TextView) findViewById(R.id.tvAmountB);
    sCurrencyA = (Spinner) findViewById(R.id.sCurrencyA);
    sCurrencyB = (Spinner) findViewById(R.id.sCurrencyB);

    ArrayAdapter<String> btcAdapter = new ArrayAdapter<String>(getContext(),
            android.R.layout.simple_spinner_item,
            new String[]{"BTC"});
    sCurrencyA.setAdapter(btcAdapter);
    sCurrencyA.setEnabled(false);
    ArrayAdapter<String> xmrAdapter = new ArrayAdapter<String>(getContext(),
            android.R.layout.simple_spinner_item,
            new String[]{"XMR"});
    sCurrencyB.setAdapter(xmrAdapter);
    sCurrencyB.setEnabled(false);
}
 
开发者ID:m2049r,项目名称:xmrwallet,代码行数:20,代码来源:ExchangeBtcTextView.java


示例8: loadCommandSpinner

import android.widget.Spinner; //导入依赖的package包/类
private void loadCommandSpinner(Spinner spinner, Command command) {
	AlertTypeItemSelectedListener listener = new AlertTypeItemSelectedListener(command);
	spinner.setOnItemSelectedListener(listener);
	List<String> list = new ArrayList<String>();
	int defaultPos = 0;
	int pos = 0;
	for (String callableCommand : callableCommandNames) {
		int resourceId = getResources().getIdentifier(callableCommand, "string", getPackageName());
		if (resourceId != 0) {
			list.add(getString(resourceId));
		}
		else {
			list.add(callableCommand);
		}
		if (callableCommand.equals(command.getMethod())) {
			defaultPos = pos;
		}
		pos++;
	}
	ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list);
	dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	spinner.setAdapter(dataAdapter);
	spinner.setSelection(defaultPos);
}
 
开发者ID:masterjc,项目名称:bluewatcher,代码行数:25,代码来源:ControlModeEditorActivity.java


示例9: onInputViewChanged

import android.widget.Spinner; //导入依赖的package包/类
/**
 */
@Override
protected void onInputViewChanged(@NonNull View inputView) {
	super.onInputViewChanged(inputView);
	if (!(inputView instanceof Spinner)) {
		throw new IllegalArgumentException("Only Spinner is allowed as input view for SpinnerLayout. Found(" + inputView + ") instead.");
	}
	this.mSpinner = (Spinner) inputView;
	if (mPrompt != null) {
		mSpinner.setPrompt(mPrompt);
	}
	if (mAdapter != null) {
		mSpinner.setAdapter(mAdapter);
		mSpinner.setSelection(mSelection, false);
		mSpinner.setOnItemSelectedListener(ITEM_SELECTED_LISTENER);
		this.updatePrivateFlags(PFLAG_ITEM_SELECTED_LISTENER_ATTACHED, true);
	}
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:20,代码来源:SpinnerLayout.java


示例10: setupViews

import android.widget.Spinner; //导入依赖的package包/类
private void setupViews() {
    textInput_Code_user     = (TextInputLayout) findViewById(R.id.textInput_Code_user);
    textInput_FullName      = (TextInputLayout) findViewById(R.id.textInput_FullName);
    textInput_TelUsr        = (TextInputLayout) findViewById(R.id.textInput_TelUsr);
    textInput_AdrUsr        = (TextInputLayout) findViewById(R.id.textInput_AdrUsr);
    textView_Password1      = (TextInputLayout) findViewById(R.id.textView_Password1);
    textView_Password2      = (TextInputLayout) findViewById(R.id.textView_Password2);
    spinner_branch          = (Spinner) findViewById(R.id.spinner_branch);

    Button button_register = (Button) findViewById(R.id.button_ajouter);

    button_register.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(!checkFields())
                Toast.makeText(RegisterActivity.this, "Erreur", Toast.LENGTH_SHORT).show();
            else
                Register();
        }
    });
}
 
开发者ID:ayounes3333,项目名称:GSB-2017-Android,代码行数:22,代码来源:RegisterActivity.java


示例11: getTeamObjects

import android.widget.Spinner; //导入依赖的package包/类
private void getTeamObjects(){
    mTeamManager = new TeamManager();
    mTeamManager.getTeams(new IGetTeamsListener() {
        @Override
        public void onGetTeams(List<Team> retrievedTeams) {
            teamNames = new ArrayList<>();
            teamIDS = new ArrayList<>();
            team_spinner = (Spinner) findViewById(R.id.team_spinner);
            theTeams = retrievedTeams;
            createTeamSpinner();
        }

        @Override
        public void onFailedTeams() {
            Toast.makeText(context, "Unable to retrieve teams.",Toast.LENGTH_LONG).show();
        }
    });
}
 
开发者ID:panzerama,项目名称:Dispatch,代码行数:19,代码来源:ShiftStartActivity.java


示例12: setNumberType

import android.widget.Spinner; //导入依赖的package包/类
private void setNumberType(View row, int type) {
    int position = 0;
    switch (type) {
        case ContactNumber.TYPE_CONTAINS:
            position = 1;
            break;
        case ContactNumber.TYPE_STARTS:
            position = 2;
            break;
        case ContactNumber.TYPE_ENDS:
            position = 3;
            break;
    }
    Spinner numberTypeSpinner = (Spinner) row.findViewById(R.id.spinner_number_type);
    numberTypeSpinner.setSelection(position);
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:17,代码来源:AddOrEditContactFragment.java


示例13: buildPaymentRequest

import android.widget.Spinner; //导入依赖的package包/类
@NonNull
private PaymentSetupRequest buildPaymentRequest(final View view) throws ParseException {
    Log.v(TAG, "buildPaymentRequest()");
    PaymentSetupRequest paymentSetupRequest = new PaymentSetupRequest();
    paymentSetupRequest.setMerchantAccount(((EditText) view.findViewById(R.id.merchantAccountEntry)).getText()
            .toString());
    final String amountValueString = ((EditText) view.findViewById(R.id.orderAmountEntry)).getText().toString();
    final String amountCurrencyString = ((EditText) view.findViewById(R.id.orderCurrencyEntry))
            .getText().toString();

    paymentSetupRequest.setAmount(new Amount(AmountUtil.parseMajorAmount(amountCurrencyString, amountValueString),
            amountCurrencyString));
    paymentSetupRequest.setCountryCode(((EditText) view.findViewById(R.id.countryEntry)).getText().toString());
    paymentSetupRequest.setShopperLocale(((EditText) view.findViewById(R.id.shopperLocaleEntry)).getText().toString());
    paymentSetupRequest.setShopperReference(((EditText) view.findViewById(R.id.shopperReferenceEntry)).getText()
            .toString());
    paymentSetupRequest.setReference(((EditText) view.findViewById(R.id.referenceEntry)).getText()
            .toString());
    String maxNumberOfInstallments = ((String) ((Spinner) view.findViewById(R.id.installmentsEntry)).getSelectedItem());
    paymentSetupRequest.setMaxNumberOfInstallments(maxNumberOfInstallments);

    return paymentSetupRequest;
}
 
开发者ID:Adyen,项目名称:adyen-android,代码行数:24,代码来源:PaymentDataEntryFragment.java


示例14: editIssue

import android.widget.Spinner; //导入依赖的package包/类
private void editIssue(View v) {
    int categoryId = ((Spinner) findViewById(R.id.nameCategorySpinner))
            .getSelectedItemPosition();
    final View vi = v;
    mCategory = Category.values()[categoryId];

    mIssueAdapter.editIssue(mIssue.getIssueAuthToken(), getUpdatedFields(),
            new IssueSimpleCallback() {
                @Override
                public void onSuccess(Issue issue) {

                    Intent intent = new Intent();
                    Bundle data = new Bundle();
                    data.putSerializable(TAG_ISSUE, issue);
                    intent.putExtra(TAG_ISSUE, data);
                    setResult(RESULT_OK, intent);
                    finish();
                }

                @Override
                public void onFailure() {
                    Snackbar.make(vi, R.string.couldnt_edit_issue, Snackbar.LENGTH_SHORT)
                            .show();
                }
            });
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:27,代码来源:EditIssueActivity.java


示例15: onCreate

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

    mTextureView = (TextureView) findViewById(R.id.movie_texture_view);
    mTextureView.setSurfaceTextureListener(this);

    // Populate file-selection spinner.
    Spinner spinner = (Spinner) findViewById(R.id.playMovieFile_spinner);
    // Need to create one of these fancy ArrayAdapter thingies, and specify the generic layout
    // for the widget itself.
    mMovieFiles = MiscUtils.getFiles(getFilesDir(), "*.mp4");
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            android.R.layout.simple_spinner_item, mMovieFiles);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner.
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(this);

    updateControls();
}
 
开发者ID:AndyZhu1991,项目名称:grafika,代码行数:23,代码来源:PlayMovieActivity.java


示例16: initUI

import android.widget.Spinner; //导入依赖的package包/类
@Override
protected void initUI() {
    mContext = this;
    mBtnGetReport = (Button) findViewById(R.id.btn_get_reports);
    chartContainer = (LinearLayout) findViewById(R.id.report_chart_view_container);
    reportContainer = (LinearLayout) findViewById(R.id.report_container);
    deviceMessage = (TextView) findViewById(R.id.device_message);
    mTvToDate = (TextView) findViewById(R.id.btn_to);
    //deviceNameText = (TextView) findViewById(R.id.deviceName);
    mDeviceSpin = (Spinner) findViewById(R.id.device_spin);
    mDataSpin = (Spinner) findViewById(R.id.data_spin);
    mllGetReport = (LinearLayout) findViewById(R.id.btn_get_reports_ll);
    mTvToDate.setOnClickListener(this);
    mllGetReport.setOnClickListener(this);
    mBtnGetReport.setOnClickListener(this);
    mDeviceSpin.setOnItemSelectedListener(this);
    mDataSpin.setOnItemSelectedListener(this);
}
 
开发者ID:Welloculus,项目名称:MobileAppForPatient,代码行数:19,代码来源:ReportsActivity.java


示例17: onBindDialogView

import android.widget.Spinner; //导入依赖的package包/类
@Override
protected void onBindDialogView(View view) {
    super.onBindDialogView(view);

    mEnabledCheckbox = (CheckBox) view.findViewById(R.id.increasing_ring);
    mEnabledCheckbox.setOnCheckedChangeListener(this);

    mMinVolumeTitle = (TextView) view.findViewById(R.id.increasing_ring_min_volume_title);

    mMinVolumeSeekBar = (SeekBar) view.findViewById(R.id.seekbar);
    AudioManager am = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
    mMinVolumeSeekBar.setSecondaryProgress(am.getStreamVolume(AudioManager.STREAM_RING));

    mRingVolumeNotice = (TextView) view.findViewById(R.id.increasing_ring_volume_notice);

    mIntervalTitle = (TextView) view.findViewById(R.id.increasing_ring_ramp_up_duration_title);
    mInterval = (Spinner) view.findViewById(R.id.increasing_ring_ramp_up_duration);
    mIntervalValues = getContext().getResources().getIntArray(R.array.increasing_ring_ramp_up_duration_values);

    getConfig();
    updateVolumeNoticeVisibility(mMinVolumeSeekBar.getProgress());
    updateEnabledStates();
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:24,代码来源:IncreasingRingPreference.java


示例18: onCreate

import android.widget.Spinner; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_habit_event);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//        IOManager.initManager(this.getApplicationContext());
//        ActivityCompat.requestPermissions(this,
//                new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION},
//                REQUEST_LOCATION);


        spinner = (Spinner) findViewById(R.id.habitTypeSpinner);
        eventTitle = (EditText) findViewById(R.id.eventTitle);
        eventComment = (EditText) findViewById(R.id.eventComment);
        photoImageButton = (ImageButton) findViewById(R.id.imageButtonPhoto);
        initListeners();
    }
 
开发者ID:CMPUT301F17T23,项目名称:routineKeen,代码行数:18,代码来源:AddHabitEvent.java


示例19: inject

import android.widget.Spinner; //导入依赖的package包/类
public void inject(Finder finder, T target, Object source) {
    target.lineChart = (LineChartView) finder.castView((View) finder.findRequiredView(source,
            R.id.linechart, "field 'lineChart'"), R.id.linechart, "field 'lineChart'");
    target.rg_weight = (RadioGroup) finder.castView((View) finder.findRequiredView(source, R
            .id.rg_weight, "field 'rg_weight'"), R.id.rg_weight, "field 'rg_weight'");
    target.spinner = (Spinner) finder.castView((View) finder.findRequiredView(source, R.id
            .spinner, "field 'spinner'"), R.id.spinner, "field 'spinner'");
    target.ll_content = (LinearLayout) finder.castView((View) finder.findRequiredView(source,
            R.id.ll_content, "field 'll_content'"), R.id.ll_content, "field 'll_content'");
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:MeasureCurveActivity$$ViewInjector.java


示例20: setSpinnerPosition

import android.widget.Spinner; //导入依赖的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:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:12,代码来源:CustomInputStylePreference.java



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