【发布时间】:2013-06-03 19:55:01
【问题描述】:
我正在尝试将项目添加到带有循环的微调器,但无法使其工作。 XML 阅读器部分有效,我只需要填充微调器。我试图修改这里复制粘贴的代码 sn-p(带有 simple_spinner_item 的代码)但没有成功。
工作流程:
1) There's an empty spinner
2) Delete all items in the spinner (in case I add items to it again)
3) Parse XML
4) Add the items from the XML to the spinner
布局:
<Spinner
android:id="@+id/SPI_Test"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:prompt="@string/test_prompt" />
查看:
//SPINNER
Spinner mySpinner = (Spinner) findViewById(R.id.SPI_Test);
//CLEAR OUT SPINNER SOMEHOW
//XML READER BOTTOM PART
for (int j = 0; j < childNodes.getLength()-1; j++) {
Node item = childNodes.item(j);
//SOMEHOW_ADD_TO_SPINNER=item.getTextContent();
【问题讨论】: