如何将项目动态的机器人加入到微调?如何将、机器人、项目、动态

2023-09-14 23:01:22 作者:一个不温柔的我

如何将项目动态的机器人加入到微调?

解决方案

 微调微调=(微调)findViewById(R.id.mySpinner);
ArrayAdapter<字符串> spinnerAdapter =新的ArrayAdapter<字符串>(这一点,android.R.layout.simple_spinner_item,android.R.id.text1);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);
spinnerAdapter.add(价值);
spinnerAdapter.notifyDataSetChanged();
 

以上是万一阵列适配器,我相信你知道如何填充值与ArrayAdapter。

我们如何才能做到这一点的情况下SimpleCursorAdapter,即如果我们有2纺纱,如果我们选择一个微调(即获得由SimpleCursorAdapter的值)的值取决于一些条件的其他微调应该充满价值。如何才能做到这一点?

武汉加速 6大项目开工 总投资达64亿元

how to add items to the spinner dynamically in android?

解决方案

Spinner spinner = (Spinner)findViewById(R.id.mySpinner);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, android.R.id.text1);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);
spinnerAdapter.add("value");
spinnerAdapter.notifyDataSetChanged();

the above is in case of the array adapter, I believe you know how to populate values with ArrayAdapter .

How can we do this in case of the SimpleCursorAdapter, i.e if we have 2 spinners and if we select the values of one spinner (that is getting the value from SimpleCursorAdapter) depending on some criteria the other spinner should be filled with values. how can we achieve that?