我的应用程序中有一个 Spinner,它的安装和配置如下:
final Spinner left = getLeftShiftSpinner(); //simple gets the Spinner by Id
left.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
left.setSelection(0);
try {
Log.d("test", "SHIFT_LEFT");
String s = content.shiftLeft(i);
content.clear();
updateScreen(s);
} catch (ScreenContent.WrongSyntaxException e) {
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
当我编译所有内容并且应用程序在我的设备上启动时,我会从其中获得输出“SHIFT_LEFT”,Log.d(...)
但我根本没有点击任何内容。应用程序只是启动,然后什么都不做就onItemSelectedListener
被触发了??有谁知道为什么??