Android自定义组合控件:SherlockSpinner

new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mLanguages);spnLanguages.setAdapter(mAdapterSystemSpinner);spnLanguages.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { showMessage("Select " + mLanguages[position]); } @Override public void onNothingSelected(AdapterView<?> parent) { showMessage("Select Nothing."); }});

OK,现在Spinner可以使用了:

3. 接着我们来设置点击事件

spnLanguages.setOnClickListener(new View.OnClickListener() {    @Override    public void onClick(View v) {        showMessage("Click Spinner");    }});

什么情况,运行后直接崩了?

FATAL EXCEPTION: mainProcess: com.sherlockshi.widget.sherlockspinner, PID: 11757java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sherlockshi.widget.sherlockspinner/com.sherlockshi.widget.MainActivity}: java.lang.RuntimeException: Don't call setOnClickListener for an AdapterView. You probably want setOnItemClickListener instead   ...Caused by: java.lang.RuntimeException: Don'