开发者

Android click events acting strangely

开发者 https://www.devze.com 2023-02-24 07:26 出处:网络
I\'ve been following these 2 tutorials to s开发者_高级运维etup a list & click events: http://mfarhan133.wordpress.com/2010/10/14/list-view-tutorial-for-android/

I've been following these 2 tutorials to s开发者_高级运维etup a list & click events:

http://mfarhan133.wordpress.com/2010/10/14/list-view-tutorial-for-android/ http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/comment-page-3/#comments

Everything seems to have worked fine up until putting in the click events:

       view.setOnClickListener(new OnClickListener() {
       public void onClick(View arg0){...

Clicking on an item in the list will operate the function normally, but it wont change the background colour as it used to. Also, scrolling the list manually and pressing enter / submit button doesn't seem to run the function, although it does change the background colour.


To handle such events you should implement AdapterView.OnItemClickListener interface and set its instance to a list view via list.setOnItemClickListener() method.

0

精彩评论

暂无评论...
验证码 换一张
取 消