0
我已經想出瞭如何從微調框中選擇一個項目後,顯示一些文本,與開關的情況下.. 但現在,如果我選擇一個項目,文本不會立即出現。Android開關微調不立即顯示
當我第一次選擇一個項目時,「spotinfo」保持空白。 當我選擇第二個項目時,它將文本添加到「spotinfo」。
有人可以告訴爲什麼文本不會立即顯示嗎?
public class InputItemSelectedListener implements OnItemSelectedListener {
public void onItemSelected(AdapterView<?> parent, View view, int pos , long id) {
spotInfo.loadData("", "text/html", "utf-8");
String data = "<div style=\"color: #949494;\">";
switch(parent.getSelectedItemPosition()){
case 0:
data += getString(R.string.Panoramaterras);
break;
case 1:
data += getString(R.string.about);
break;
}
data += "</div>";
spotInfo.loadData(data, "text/html", "utf-8");
}
public void onNothingSelected(AdapterView<?> parent) {
// Do nothing.
}
}