本文整理了Java中android.widget.Spinner.setPrompt()
方法的一些代码示例,展示了Spinner.setPrompt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.setPrompt()
方法的具体详情如下:
包路径:android.widget.Spinner
类名称:Spinner
方法名:setPrompt
暂无
代码示例来源:origin: stackoverflow.com
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setPrompt("Select your favorite Planet!");
spinner.setAdapter(
new NothingSelectedSpinnerAdapter(
adapter,
R.layout.contact_spinner_row_nothing_selected,
// R.layout.contact_spinner_nothing_selected_dropdown, // Optional
this));
代码示例来源:origin: consp1racy/android-support-preference
@Override
public void setPrompt(@Nullable final CharSequence prompt) {
super.setPrompt(prompt);
mPrompt = prompt;
}
代码示例来源:origin: com.albedinsky.android/ui
/**
* Delegate method for {@link android.widget.Spinner#setPrompt(CharSequence)}.
*/
public void setPrompt(@Nullable CharSequence prompt) {
this.mPrompt = prompt;
if (mSpinner != null) mSpinner.setPrompt(mPrompt);
}
代码示例来源:origin: com.albedinsky.android/ui-widget-input
/**
* Delegate method for {@link android.widget.Spinner#setPrompt(CharSequence)}.
*/
public void setPrompt(@Nullable CharSequence prompt) {
this.mPrompt = prompt;
if (mSpinner != null) mSpinner.setPrompt(mPrompt);
}
代码示例来源:origin: stackoverflow.com
ArrayAdapter arrayAdapter = null;
String[] list=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//you can replace the below list with your list
list = {"Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune","Pluto"};
final Spinner spinner = (Spinner) findViewById(R.id.spinner);
arrayAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spinner.setAdapter(arrayAdapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
spinner.setPrompt("Your selected item is:"+list[position]);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
代码示例来源:origin: stackoverflow.com
final Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setPrompt("Select a planet");
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
spinner.setPrompt(list[position]);
Toast.makeText(getApplicationContext(),"You have selected "+list[position],Toast.LENGTH_SHORT).show();
代码示例来源:origin: stackoverflow.com
ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_spinner_item,spinnerArray);
spinner.setAdapter(adapter);
spinner.setPrompt("works");
linear.addView(spinner);
Toast.makeText(getApplicationContext(), "bottom", 1000).show();
代码示例来源:origin: stackoverflow.com
public class a extends Activity {
private static final String ACTIVITIES = "activities";
private Spinner spinner1;
private EditText ETinfo;
private SharedPreferences savedActivities;
private ArrayList<String> details;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_akmain);
Spinner dropdown = (Spinner)findViewById(R.id.spinner1);
String[] items = new String[]{"Walking", "Running", "Stairs", "Generic"};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item, items);
dropdown.setAdapter(adapter);
dropdown.setPrompt("Select Activity");
ETinfo = (EditText)findViewById(R.id.ETinfo);
savedActivities = getSharedPreferences(ACTIVITIES, MODE_PRIVATE);
details = new ArrayList<String>(savedActivities.getAll().keySet());
Collections.sort(details, String.CASE_INSENSITIVE_ORDER);
public OnClickListener saveButtonListener = new OnClickListener(){
public void onClick(View v){
addDetailedActivity(ETinfo.getText().toString());
ETinfo.setText("");
}
};
}
}
代码示例来源:origin: com.albedinsky.android/ui
/**
*/
@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);
}
}
代码示例来源:origin: com.albedinsky.android/ui-widget-input
/**
*/
@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);
}
}
代码示例来源:origin: stackoverflow.com
AdapterT.setDropDownViewResource(android.R.layout.simple_spinner_item);
spType.setAdapter(AdapterT);
spType.setPrompt("Select Type");
spType.setOnItemSelectedListener(this);
etWeight = (EditText) findViewById(R.id.etWeight);
代码示例来源:origin: cyclestreets/android
private void setupGender(final Spinner gender) {
final List<String> genders = Arrays.asList(getString(R.string.savetrip_please_select),
getString(R.string.savetrip_gender_male),
getString(R.string.savetrip_gender_female),
getString(R.string.savetrip_gender_private));
gender.setPrompt(getString(R.string.savetrip_gender_prompt));
gender.setAdapter(new SpinnerList(this, genders));
int index = prefs_.getInt("gender", 0);
gender.setSelection(index);
gender.setOnItemSelectedListener(this);
}
代码示例来源:origin: stackoverflow.com
spinnerTaglia.setPrompt("Seleziona la taglia!");
代码示例来源:origin: cyclestreets/android
private void setupExperience(final Spinner experience) {
final List<String> experienceLevels = Arrays.asList(getString(R.string.savetrip_please_select),
getString(R.string.savetrip_experience_experienced),
getString(R.string.savetrip_experience_infrequent),
getString(R.string.savetrip_experience_beginner));
experience.setPrompt(getString(R.string.savetrip_experience_prompt));
experience.setAdapter(new SpinnerList(this, experienceLevels));
int index = prefs_.getInt("experience", 0);
experience.setSelection(index);
experience.setOnItemSelectedListener(this);
}
代码示例来源:origin: stackoverflow.com
mContactPhoneTypeSpinner.setPrompt(getString(R.string.selectLabel));
代码示例来源:origin: ChintanRathod/HintSpinnerAdapter
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Spinner ordinarySpinner = (Spinner) findViewById(R.id.ordinarySpinner);
Spinner hintSpinner = (Spinner) findViewById(R.id.hintSpinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.color, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
ordinarySpinner.setPrompt("Select your favorite color!");
ordinarySpinner.setAdapter(adapter);
hintSpinner.setAdapter(new HintSpinnerAdapter(
adapter, R.layout.hint_row_item, this));
}
代码示例来源:origin: dkharrat/NexusDialog
Spinner spinnerView = new Spinner(getContext());
spinnerView.setId(spinnerId);
spinnerView.setPrompt(prompt);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, items) {
@NonNull
代码示例来源:origin: stackoverflow.com
getRecords();
category.setAdapter(adapter);
category.setPrompt("Category");
代码示例来源:origin: GeoODK/collect
spinner.setPrompt(prompt.getQuestionText());
spinner.setEnabled(!prompt.isReadOnly());
spinner.setFocusable(!prompt.isReadOnly());
代码示例来源:origin: dsolonenko/financisto
applyFilter();
spOperation.setPrompt(getString(R.string.mass_operations));
spOperation.setAdapter(EnumUtils.createSpinnerAdapter(this, operations));
prepareTransactionActionGrid();
内容来源于网络,如有侵权,请联系作者删除!