我已经找了几个帖子来解决同样的问题,但似乎无法解决我的问题.我在整个应用程序中都使用过微调器,它们工作正常.当我尝试在弹出窗口中使用微调器时,我在选择它时会出错.弹出窗口是添加引用,我已经声明了一个全局ViewGroup变量(即vg_references),可用于检索弹出窗口中的组件.弹出窗口的代码如下.
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
vg_references = (ViewGroup)inflater.inflate(R.layout.reference, null, false);
pw_references = new PopupWindow(vg_references,
this.getWindowManager().getDefaultDisplay().getWidth()/100 * 75,
this.getWindowManager().getDefaultDisplay().getHeight()/100 * 50,
true);
pw_references.setFocusable(true);
pw_references.showAtLocation((View)view.getParent(), Gravity.CENTER, 0, 0);
this.populateReferenceView();
Run Code Online (Sandbox Code Playgroud)
然后,这将调用一个函数来填充弹出窗口中的组件(例如,文本字段,微调器,布局等...).此函数的一部分是使用数据库中的字符串列表填充微调器.
// Find the spinner
Spinner spinReferenceSourceTypes = (Spinner) vg_references.findViewById(R.id.spin_referencesSourceTypes);
// Retrieve the list of reference source types and create an array adapter to attach to the list
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(
this, android.R.layout.simple_spinner_item, databaseHelper.getReferenceSourceTypes());
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinReferenceSourceTypes.setAdapter(dataAdapter);
// If there's only 1 item in the dropdown list, disable the dropdown list …Run Code Online (Sandbox Code Playgroud) 我正面临着关于微调器的问题.假设弹出一个微调器对话框,如果在我解锁屏幕时发生了熨平板锁定,那么弹出器弹出窗口就不会显示在那里.任何人都可以建议我任何解决方案或任何人都知道如何在onResume中实用弹出微调器对话框.