简体   繁体   English

如何以编程方式在 android 中显示微调器弹出窗口

[英]How to programmatically show spinner pop up in android

I am facing a problem about spinner.我正面临一个关于微调器的问题。 Suppose an spinner dialog is pop up and if in that time locking of screed occur when I unlock the screen the spinner pop up is not shown there.假设弹出一个微调器对话框,如果在我解锁屏幕时发生熨平板锁定,则微调器弹出窗口不会显示在那里。 Can anyone suggest me any solution of this or can anyone know how to pragmatically pop up spinner dialog in onResume.谁能建议我解决这个问题,或者谁能知道如何在 onResume 中实用地弹出微调器对话框。

Try spinner.performClick();试试spinner.performClick(); . . For me it is working.对我来说它正在工作。

Try This试试这个

Spinner spinner = new Spinner(this);
    ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, spinnerArray); //selected item will look like a spinner set from XML
    spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(spinnerArrayAdapter);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM